##// END OF EJS Templates
Cleaner version of color table by P. Wang.
Fernando Perez -
Show More
@@ -26,6 +26,7 b' def make_color_table(in_class):'
26 Helper function for building the *TermColors classes."""
26 Helper function for building the *TermColors classes."""
27
27
28 color_templates = (
28 color_templates = (
29 # Dark colors
29 ("Black" , "0;30"),
30 ("Black" , "0;30"),
30 ("Red" , "0;31"),
31 ("Red" , "0;31"),
31 ("Green" , "0;32"),
32 ("Green" , "0;32"),
@@ -34,6 +35,7 b' def make_color_table(in_class):'
34 ("Purple" , "0;35"),
35 ("Purple" , "0;35"),
35 ("Cyan" , "0;36"),
36 ("Cyan" , "0;36"),
36 ("LightGray" , "0;37"),
37 ("LightGray" , "0;37"),
38 # Light colors
37 ("DarkGray" , "1;30"),
39 ("DarkGray" , "1;30"),
38 ("LightRed" , "1;31"),
40 ("LightRed" , "1;31"),
39 ("LightGreen" , "1;32"),
41 ("LightGreen" , "1;32"),
@@ -41,18 +43,17 b' def make_color_table(in_class):'
41 ("LightBlue" , "1;34"),
43 ("LightBlue" , "1;34"),
42 ("LightPurple" , "1;35"),
44 ("LightPurple" , "1;35"),
43 ("LightCyan" , "1;36"),
45 ("LightCyan" , "1;36"),
44 ("White" , "1;37"), )
46 ("White" , "1;37"),
45
47 # Blinking colors. Probably should not be used in anything serious.
46 for name,value in color_templates:
48 ("BlinkBlack" , "5;30"),
47 setattr(in_class,name,in_class._base % value)
49 ("BlinkRed" , "5;31"),
48
50 ("BlinkGreen" , "5;32"),
49 # Automatically add Blink versions of the above colors. This
51 ("BlinkYellow" , "5;33"),
50 # just involves setting the attribute field (before the first
52 ("BlinkBlue" , "5;34"),
51 # semicolon) to '5'.
53 ("BlinkPurple" , "5;35"),
52 # Note: this is a little easter egg contributed by Peter Wang from
54 ("BlinkCyan" , "5;36"),
53 # Enthought at the Scipy2008 sprint :)
55 ("BlinkLightGray", "5;37"),
54 value = '5'+value[1:]
56 )
55 setattr(in_class,"Blink"+name,in_class._base % value)
56
57
57
58
58 class TermColors:
59 class TermColors:
General Comments 0
You need to be logged in to leave comments. Login now