Skip to content

Commit

Permalink
Fixed loading settings and revert commands
Browse files Browse the repository at this point in the history
  • Loading branch information
TerminalFi committed Mar 9, 2020
1 parent b794431 commit 01967b2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 6 additions & 2 deletions color_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def _add_colors_to_scheme(self, color_scheme_json):
entry["background"] = color_background
settings.append(entry)

color_scheme_plist["rules"] = settings
return updates_made, color_scheme_plist
color_scheme_json["rules"] = settings
return updates_made, color_scheme_json

def _create_custom_color_scheme_directory(self):
package_path = sublime.packages_path()
Expand Down Expand Up @@ -94,6 +94,10 @@ def create_user_custom_theme(self):
)
if self.regenerate:
print("[Colored Comments] Regenerating theme file")
try:
os.remove(new_cs_absolute)
except:
pass
with open(new_cs_absolute, "w") as outfile:
json.dump(color_scheme, outfile, indent=4)
elif updates_made or preferences_cs != new_cs:
Expand Down
4 changes: 3 additions & 1 deletion colored_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re

NAME = "Colored Comments"
VERSION = "2.0.0"
VERSION = "2.0.3"
SETTINGS = dict()
TAG_MAP = dict()

Expand Down Expand Up @@ -108,6 +108,7 @@ def ApplyDecorations(self, delimiter, regions, tags, settings):
class ColoredCommentsThemeGeneratorCommand(sublime_plugin.TextCommand):
def run(self, edit):
global TAG_MAP, SETTINGS
get_settings()
color_scheme_manager = ColorManager(
"User/Colored Comments", TAG_MAP, SETTINGS, True
)
Expand All @@ -117,6 +118,7 @@ def run(self, edit):
class ColoredCommentsThemeRevertCommand(sublime_plugin.TextCommand):
def run(self, edit):
global SETTINGS
get_settings()
preferences = sublime.load_settings("Preferences.sublime-settings")
preferences.set("color_scheme", SETTINGS.get("old_color_scheme", ""))
sublime.save_settings("Preferences.sublime-settings")
Expand Down
8 changes: 4 additions & 4 deletions colored_comments.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{
"name": "important",
"foreground": "#cc0000",
"background": "var(--background)"
"background": "rgba(1,22,38, 0.1)"
},
},
"Deprecated":
Expand All @@ -23,7 +23,7 @@
{
"name": "deprecated",
"foreground": "#9933ff",
"background": "var(--background)"
"background": "rgba(1,22,38, 0.1)"
},
},
"Question":
Expand All @@ -33,7 +33,7 @@
{
"name": "question",
"foreground": "#0099ff",
"background": "var(--background)"
"background": "rgba(1,22,38, 0.1)"
},
},
"TODO":
Expand All @@ -43,7 +43,7 @@
{
"name": "todo",
"foreground": "#ff9900",
"background": "var(--background)"
"background": "rgba(1,22,38, 0.1)"
},
}
}
Expand Down

0 comments on commit 01967b2

Please sign in to comment.