Skip to content

Commit

Permalink
fix color scheme keys for #16
Browse files Browse the repository at this point in the history
  • Loading branch information
mechatroner committed Mar 21, 2019
1 parent 71f78d9 commit 01525b2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
20 changes: 10 additions & 10 deletions RainbowCSV.sublime-color-scheme
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
"caret": "#F8F8F0",
"foreground": "#F8F8F2",
"invisibles": "#3B3A32",
"lineHighlight": "#3E3D32",
"line_highlight": "#3E3D32",
"selection": "#49483E",
"findHighlight": "#FFE792",
"findHighlightForeground": "#000000",
"selectionBorder": "#222218",
"activeGuide": "#9D550FB0",
"find_highlight": "#FFE792",
"find_highlight_foreground": "#000000",
"selection_border": "#222218",
"active_guide": "#9D550FB0",
"misspelling": "#F92672",
"bracketsForeground": "#F8F8F2A5",
"bracketsOptions": "underline",
"bracketContentsForeground": "#F8F8F2A5",
"bracketContentsOptions": "underline",
"tagsOptions": "stippled_underline"
"brackets_foreground": "#F8F8F2A5",
"brackets_options": "underline",
"bracket_contents_foreground": "#F8F8F2A5",
"bracket_contents_options": "underline",
"tags_options": "stippled_underline"
},
"rules":
[
Expand Down
25 changes: 12 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,24 @@ def do_adjust_color_scheme(style):
rgb_value = hex_to_rgb(background_color)
is_dark_theme = rgb_value[0] + rgb_value[1] + rgb_value[2] < 128 * 3

color_scheme['globals']["bracketContentsOptions"] = "underline"
color_scheme['globals']["tagsOptions"] = "stippled_underline"
color_scheme['globals']["bracket_contents_options"] = "underline"
color_scheme['globals']["tags_options"] = "stippled_underline"

color_keys = [
'background',
'caret',
'foreground',
'invisibles',
'lineHighlight',
'line_highlight',
'selection',
'findHighlight',
'findHighlightForeground',
'selectionBorder',
'activeGuide',
'find_highlight',
'find_highlight_foreground',
'selection_border',
'active_guide',
'misspelling',
'bracketsForeground',
'bracketsOptions',
'bracketContentsForeground'
'brackets_foreground',
'brackets_options',
'bracket_contents_foreground'
]

rainbow_colors_dark = [
Expand Down Expand Up @@ -136,9 +136,8 @@ def do_adjust_color_scheme(style):
rainbow_colors = rainbow_colors_dark if is_dark_theme else rainbow_colors_light

for key in color_keys:
normalized_key = re.sub(r'([A-Z])', r'_\1', key).lower()
if normalized_key in style:
color_scheme['globals'][key] = style[normalized_key]
if key in style:
color_scheme['globals'][key] = style[key]

for i, scope_name in enumerate(rainbow_scope_names):
color_scheme['rules'].append({'name': 'rainbow csv rainbow{}'.format(i + 1), 'scope': scope_name, 'foreground': rainbow_colors[i]})
Expand Down

0 comments on commit 01525b2

Please sign in to comment.