ThirdParty/Pygments/pygments/style.py

branch
Py2 comp.
changeset 3079
0233bbe9a9c4
parent 2669
11a6696ff868
child 4172
4f20dba37ab6
equal deleted inserted replaced
3066:76a310bc7bba 3079:0233bbe9a9c4
6 Basic style object. 6 Basic style object.
7 7
8 :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
9 :license: BSD, see LICENSE for details. 9 :license: BSD, see LICENSE for details.
10 """ 10 """
11
12 from __future__ import unicode_literals # __IGNORE_WARNING__
13 11
14 from pygments.token import Token, STANDARD_TYPES 12 from pygments.token import Token, STANDARD_TYPES
15 13
16 def with_metaclass(meta, base=object): 14 def with_metaclass(meta, base=object):
17 """ 15 """
20 """ 18 """
21 return meta("NewBase", (base,), {}) 19 return meta("NewBase", (base,), {})
22 20
23 21
24 class StyleMeta(type): 22 class StyleMeta(type):
23 background_color = '#ffffff'
24
25 #: highlight background color
26 highlight_color = '#ffffcc'
27
28 #: Style definitions for individual token types.
29 styles = {}
25 30
26 def __new__(mcs, name, bases, dct): 31 def __new__(mcs, name, bases, dct):
27 obj = type.__new__(mcs, name, bases, dct) 32 obj = type.__new__(mcs, name, bases, dct)
28 for token in STANDARD_TYPES: 33 for token in STANDARD_TYPES:
29 if token not in obj.styles: 34 if token not in obj.styles:
112 def __len__(cls): 117 def __len__(cls):
113 return len(cls._styles) 118 return len(cls._styles)
114 119
115 120
116 class Style(with_metaclass(StyleMeta, object)): 121 class Style(with_metaclass(StyleMeta, object)):
117 background_color = '#ffffff' 122 pass
118
119 #: highlight background color
120 highlight_color = '#ffffcc'
121
122 #: Style definitions for individual token types.
123 styles = {}

eric ide

mercurial