eric6/ThirdParty/Pygments/pygments/formatters/irc.py

changeset 7547
21b0534faebc
parent 6942
2602857055c5
child 7701
25f42e208e08
equal deleted inserted replaced
7546:bf5f777260a6 7547:21b0534faebc
3 pygments.formatters.irc 3 pygments.formatters.irc
4 ~~~~~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 Formatter for IRC output 6 Formatter for IRC output
7 7
8 :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2019 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 import sys 12 import sys
13 13
23 #: Map token types to a tuple of color values for light and dark 23 #: Map token types to a tuple of color values for light and dark
24 #: backgrounds. 24 #: backgrounds.
25 IRC_COLORS = { 25 IRC_COLORS = {
26 Token: ('', ''), 26 Token: ('', ''),
27 27
28 Whitespace: ('lightgray', 'darkgray'), 28 Whitespace: ('gray', 'brightblack'),
29 Comment: ('lightgray', 'darkgray'), 29 Comment: ('gray', 'brightblack'),
30 Comment.Preproc: ('teal', 'turquoise'), 30 Comment.Preproc: ('cyan', 'brightcyan'),
31 Keyword: ('darkblue', 'blue'), 31 Keyword: ('blue', 'brightblue'),
32 Keyword.Type: ('teal', 'turquoise'), 32 Keyword.Type: ('cyan', 'brightcyan'),
33 Operator.Word: ('purple', 'fuchsia'), 33 Operator.Word: ('magenta', 'brightcyan'),
34 Name.Builtin: ('teal', 'turquoise'), 34 Name.Builtin: ('cyan', 'brightcyan'),
35 Name.Function: ('darkgreen', 'green'), 35 Name.Function: ('green', 'brightgreen'),
36 Name.Namespace: ('_teal_', '_turquoise_'), 36 Name.Namespace: ('_cyan_', '_brightcyan_'),
37 Name.Class: ('_darkgreen_', '_green_'), 37 Name.Class: ('_green_', '_brightgreen_'),
38 Name.Exception: ('teal', 'turquoise'), 38 Name.Exception: ('cyan', 'brightcyan'),
39 Name.Decorator: ('darkgray', 'lightgray'), 39 Name.Decorator: ('brightblack', 'gray'),
40 Name.Variable: ('darkred', 'red'), 40 Name.Variable: ('red', 'brightred'),
41 Name.Constant: ('darkred', 'red'), 41 Name.Constant: ('red', 'brightred'),
42 Name.Attribute: ('teal', 'turquoise'), 42 Name.Attribute: ('cyan', 'brightcyan'),
43 Name.Tag: ('blue', 'blue'), 43 Name.Tag: ('brightblue', 'brightblue'),
44 String: ('brown', 'brown'), 44 String: ('yellow', 'yellow'),
45 Number: ('darkblue', 'blue'), 45 Number: ('blue', 'brightblue'),
46 46
47 Generic.Deleted: ('red', 'red'), 47 Generic.Deleted: ('brightred', 'brightred'),
48 Generic.Inserted: ('darkgreen', 'green'), 48 Generic.Inserted: ('green', 'brightgreen'),
49 Generic.Heading: ('**', '**'), 49 Generic.Heading: ('**', '**'),
50 Generic.Subheading: ('*purple*', '*fuchsia*'), 50 Generic.Subheading: ('*magenta*', '*brightmagenta*'),
51 Generic.Error: ('red', 'red'), 51 Generic.Error: ('brightred', 'brightred'),
52 52
53 Error: ('_red_', '_red_'), 53 Error: ('_brightred_', '_brightred_'),
54 } 54 }
55 55
56 56
57 IRC_COLOR_MAP = { 57 IRC_COLOR_MAP = {
58 'white': 0, 58 'white': 0,
59 'black': 1, 59 'black': 1,
60 'darkblue': 2, 60 'blue': 2,
61 'green': 3, 61 'brightgreen': 3,
62 'red': 4, 62 'brightred': 4,
63 'brown': 5, 63 'yellow': 5,
64 'purple': 6, 64 'magenta': 6,
65 'orange': 7, 65 'orange': 7,
66 'darkgreen': 7, #compat w/ ansi 66 'green': 7, #compat w/ ansi
67 'yellow': 8, 67 'brightyellow': 8,
68 'lightgreen': 9, 68 'lightgreen': 9,
69 'turquoise': 9, # compat w/ ansi 69 'brightcyan': 9, # compat w/ ansi
70 'teal': 10, 70 'cyan': 10,
71 'lightblue': 11, 71 'lightblue': 11,
72 'darkred': 11, # compat w/ ansi 72 'red': 11, # compat w/ ansi
73 'blue': 12, 73 'brightblue': 12,
74 'fuchsia': 13, 74 'brightmagenta': 13,
75 'darkgray': 14, 75 'brightblack': 14,
76 'lightgray': 15, 76 'gray': 15,
77 } 77 }
78 78
79 def ircformat(color, text): 79 def ircformat(color, text):
80 if len(color) < 1: 80 if len(color) < 1:
81 return text 81 return text

eric ide

mercurial