2009-07-24 00:15:21 -04:00
|
|
|
import color
|
|
|
|
from mode import Fundamental
|
|
|
|
from lex import Grammar, PatternRule
|
|
|
|
|
2009-07-24 00:30:11 -04:00
|
|
|
# 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).
|
|
|
|
|
2009-07-24 00:15:21 -04:00
|
|
|
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 = {}
|
|
|
|
|
2009-07-24 00:30:11 -04:00
|
|
|
for name, r, g, b in color.iter256():
|
2009-07-24 00:15:21 -04:00
|
|
|
name2 = name + str(r) + str(g) + str(b)
|
|
|
|
ColortestGrammar.rules.append(PatternRule('z-' + name2, name2))
|
|
|
|
Colortest.colors['z-' + name2] = (name2, 'default')
|
|
|
|
|
|
|
|
install = Colortest.install
|