#! /usr/bin/env python """xchatcolor.py Prints the color that the nickname would have in xchat-2. """ # from common/text.c: color_of() # [19, 20, 22, 24, 25, 26, 27, 28, 29] COLORS = [ "green", "red", "dark purple", "yellow", "lime", "slate", "cyan", "blue", "purple", ] def color_of(nickname): n = sum(map(ord, nickname)) return COLORS[n % len(COLORS)] if __name__ == '__main__': import sys for name in sys.argv[1:]: print '%s: %s' % (name, color_of(name))