3 pygments.style |
3 pygments.style |
4 ~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~ |
5 |
5 |
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-2014 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 from pygments.token import Token, STANDARD_TYPES |
12 from pygments.token import Token, STANDARD_TYPES |
13 |
13 from pygments.util import add_metaclass |
14 def with_metaclass(meta, base=object): |
|
15 """ |
|
16 Python independent version to create a base class with a metaclass. |
|
17 Taken from six 1.3.0 (http://pythonhosted.org/six) |
|
18 """ |
|
19 return meta("NewBase", (base,), {}) |
|
20 |
14 |
21 |
15 |
22 class StyleMeta(type): |
16 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 = {} |
|
30 |
17 |
31 def __new__(mcs, name, bases, dct): |
18 def __new__(mcs, name, bases, dct): |
32 obj = type.__new__(mcs, name, bases, dct) |
19 obj = type.__new__(mcs, name, bases, dct) |
33 for token in STANDARD_TYPES: |
20 for token in STANDARD_TYPES: |
34 if token not in obj.styles: |
21 if token not in obj.styles: |