Skip to content

Instantly share code, notes, and snippets.

@Nama
Last active March 20, 2016 21:36
Show Gist options
  • Save Nama/95bb43a12e2a394cb2f6 to your computer and use it in GitHub Desktop.
Save Nama/95bb43a12e2a394cb2f6 to your computer and use it in GitHub Desktop.
Custom user colors by user mode. Only effects the chat, not the userlist.
import hexchat
__module_name__ = 'color ranks'
__module_author__ = 'Yama'
__module_version__ = '0.1'
__module_description__ = 'Make user colors by rank'
def mod_colors(word, word_eol, userdata):
nickname = hexchat.strip(word[0], len(word[0]), 1)
nickname += '\003'
message = word[1]
if len(word) > 2:
mode = word[2]
if mode in ('&', '@', '%'):
color = '\0034'
elif mode == '~':
color = '\0035'
elif mode == '+':
color = '\00314'
mode = color + mode
else:
mode = '\0033'
hexchat.prnt('<{}{}> {}'.format(mode, nickname, message))
return hexchat.EAT_ALL
hexchat.hook_print('Channel Message', mod_colors)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment