import color from mode import Fundamental from lex import Grammar, PatternRule # this mode is kind of fake--it creates and loads a whole bunch of fake token # classes that are used to populate the view-token-colors command with useful # versions of the 256 colors (e.g. red-401, magenta-503, etc). class ColortestGrammar(Grammar): rules = [] for i in range(0, 256): c = '%02x' % i rules.append(PatternRule('z' + c, c)) class Colortest(Fundamental): name = 'Colortest' grammar = ColortestGrammar colors = {} for name, r, g, b in color.iter256(): name2 = name + str(r) + str(g) + str(b) ColortestGrammar.rules.append(PatternRule('z-' + name2, name2)) Colortest.colors['z-' + name2] = (name2, 'default') install = Colortest.install