From 92a2ebfe847c747b52c51c481e9d5103c21f9bac Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Fri, 24 Jul 2009 00:15:21 -0400 Subject: [PATCH] restored --HG-- branch : pmacs2 --- mode/colortest.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 mode/colortest.py diff --git a/mode/colortest.py b/mode/colortest.py new file mode 100644 index 0000000..6027d65 --- /dev/null +++ b/mode/colortest.py @@ -0,0 +1,37 @@ +import color +from mode import Fundamental +from lex import Grammar, PatternRule + +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 = {} + +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') + +for name, r, g, b in color.iter256(): + abc(name, r, g, b) + +#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) + +install = Colortest.install