2009-06-10 23:41:53 -04:00
|
|
|
import color
|
2009-06-10 12:05:24 -04:00
|
|
|
from mode import Fundamental
|
|
|
|
from lex import Grammar, PatternRule
|
|
|
|
|
|
|
|
class ColortestGrammar(Grammar):
|
|
|
|
rules = []
|
|
|
|
for i in range(0, 256):
|
|
|
|
c = '%02x' % i
|
2009-06-10 16:07:03 -04:00
|
|
|
rules.append(PatternRule('z' + c, c))
|
2009-06-10 12:05:24 -04:00
|
|
|
|
|
|
|
class Colortest(Fundamental):
|
|
|
|
name = 'Colortest'
|
|
|
|
grammar = ColortestGrammar
|
|
|
|
colors = {}
|
2009-06-10 17:55:33 -04:00
|
|
|
|
|
|
|
def abc(name, r, g, b):
|
|
|
|
name2 = name + str(r) + str(g) + str(b)
|
|
|
|
ColortestGrammar.rules.append(PatternRule('z-' + name2, name2))
|
|
|
|
Colortest.colors['z-' + name2] = (name2, 'default')
|
|
|
|
|
2009-06-10 23:41:53 -04:00
|
|
|
for name, r, g, b in color.iter256():
|
|
|
|
abc(name, r, g, b)
|
2009-06-10 17:55:33 -04:00
|
|
|
|
2009-06-10 23:41:53 -04:00
|
|
|
#for i in range(1, 6):
|
|
|
|
# for j in range(0, i):
|
|
|
|
# for k in range(0, i):
|
|
|
|
# abc('red', i, j, k)
|
|
|
|
# abc('green', j, i, k)
|
|
|
|
# abc('blue', j, k, i)
|
|
|
|
#
|
|
|
|
#for i in range(1, 6):
|
|
|
|
# for j in range(0, i):
|
|
|
|
# abc('yellow', i, i, j)
|
|
|
|
# abc('cyan', j, i, i)
|
|
|
|
# abc('magenta', i, j, i)
|
2009-06-10 12:05:24 -04:00
|
|
|
|
|
|
|
install = Colortest.install
|