diff --git a/mode/python.py b/mode/python.py index cf886c9..7f14889 100644 --- a/mode/python.py +++ b/mode/python.py @@ -550,6 +550,37 @@ class PythonContext(context.Context): for k in range(last, y2): self.namelines[k] = (curr, None) +# white is for delimiters, operators, numbers +default = ('default', 'default') + +# magenta is for reserved words +lo_magenta = ('magenta202', 'default') +hi_magenta = ('magenta505', 'default') + +# red is for comments +lo_red = ('red300', 'default') +hi_red = ('red511', 'default') + +# orange is unused +hi_orange = ('yellow531', 'default') +lo_orange = ('yellow520', 'default') + +# yellow is for class names +hi_yellow = ('yellow551', 'default') +lo_yellow = ('yellow330', 'default') + +# green is for strings +lo_green = ('green030', 'default') +hi_green = ('green050', 'default') + +# cyan is for keywords and some operators +lo_cyan = ('cyan033', 'default') +hi_cyan = ('cyan155', 'default') + +# blue is for functions and methods +lo_blue = ('blue113', 'default') +hi_blue = ('blue225', 'default') + class Python(mode.Fundamental): description = ''' This programming mode is designed to edit Python source files. It @@ -561,7 +592,6 @@ class Python(mode.Fundamental): ''' name = 'Python' extensions = ['.py'] - #detection = ['python'] detection = [re.compile('^#!(?:.+[/ ])python')] tabbercls = PythonTabber grammar = PythonGrammar @@ -571,27 +601,27 @@ class Python(mode.Fundamental): closetags = {')': '(', ']': '[', '}': '{'} commentc = '#' colors = { - 'python.def': ('blue', 'default', 'bold'), - 'python.class': ('yellow', 'default', 'bold'), - 'python.decorator': ('magenta', 'default'), - 'python.reserved': ('magenta', 'default', 'bold'), - 'python.keyword': ('cyan', 'default', 'bold'), - 'python.builtin': ('cyan', 'default', 'bold'), - 'python.method': ('default', 'default'), - 'python.function': ('default', 'default'), - 'python.system_identifier': ('cyan', 'default', 'bold'), - 'python.private_identifier': ('default', 'default'), - 'python.hidden_identifier': ('default', 'default'), - 'python.identifier': ('default', 'default'), - 'python.integer': ('default', 'default'), - 'python.float': ('default', 'default'), - 'python.imaginary': ('default', 'default'), - 'python.operator': ('default', 'default'), - 'rawstring.start': ('green', 'default', 'bold'), - 'rawstring.data': ('green', 'default', 'bold'), - 'rawstring.null': ('green', 'default', 'bold'), - 'rawstring.escaped': ('magenta', 'default', 'bold'), - 'rawstring.end': ('green', 'default', 'bold'), + 'python.def': hi_blue, + 'python.class': hi_yellow, + 'python.decorator': lo_magenta, + 'python.reserved': hi_magenta, + 'python.keyword': hi_cyan, + 'python.builtin': hi_cyan, + 'python.method': default, + 'python.function': default, + 'python.system_identifier': hi_cyan, + 'python.private_identifier': default, + 'python.hidden_identifier': default, + 'python.identifier': default, + 'python.integer': default, + 'python.float': default, + 'python.imaginary': default, + 'python.operator': default, + 'rawstring.start': lo_green, + 'rawstring.end': lo_green, + 'rawstring.data': hi_green, + 'rawstring.null': hi_green, + 'rawstring.escaped': hi_magenta, } config = { 'python.lib': '.',