10 """ |
10 """ |
11 |
11 |
12 from __future__ import unicode_literals # __IGNORE_WARNING__ |
12 from __future__ import unicode_literals # __IGNORE_WARNING__ |
13 |
13 |
14 from pygments.token import Token, STANDARD_TYPES |
14 from pygments.token import Token, STANDARD_TYPES |
|
15 |
|
16 def with_metaclass(meta, base=object): |
|
17 """ |
|
18 Python independent version to create a base class with a metaclass. |
|
19 Taken from six 1.3.0 (http://pythonhosted.org/six) |
|
20 """ |
|
21 return meta("NewBase", (base,), {}) |
15 |
22 |
16 |
23 |
17 class StyleMeta(type): |
24 class StyleMeta(type): |
18 |
25 |
19 def __new__(mcs, name, bases, dct): |
26 def __new__(mcs, name, bases, dct): |
104 |
111 |
105 def __len__(cls): |
112 def __len__(cls): |
106 return len(cls._styles) |
113 return len(cls._styles) |
107 |
114 |
108 |
115 |
109 class Style(object, metaclass=StyleMeta): |
116 class Style(with_metaclass(StyleMeta, object)): |
110 background_color = '#ffffff' |
117 background_color = '#ffffff' |
111 |
118 |
112 #: highlight background color |
119 #: highlight background color |
113 highlight_color = '#ffffcc' |
120 highlight_color = '#ffffcc' |
114 |
121 |