Last active
March 22, 2016 23:22
-
-
Save KevinJMao/bd2af61413b3e0904862 to your computer and use it in GitHub Desktop.
Sublime Text 2/3 plugin snippet for toggling between two different Themes and Color Schemes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sublime, sublime_plugin | |
| class ToggleThemeAndSchemeCommand(sublime_plugin.TextCommand): | |
| def run(self, edit, **args): | |
| s = sublime.load_settings("Preferences.sublime-settings") | |
| scheme1 = args["color_scheme_1"] | |
| theme1 = args["theme_1"] | |
| scheme2 = args["color_scheme_2"] | |
| theme2 = args["theme_2"] | |
| current_scheme = s.get("color_scheme", scheme1) | |
| current_theme = s.get("theme", theme1) | |
| new_scheme = scheme2 | |
| new_theme = theme2 | |
| if current_theme == theme1: | |
| new_scheme = scheme2 | |
| new_theme = theme2 | |
| else: | |
| new_scheme = scheme1 | |
| new_theme = theme1 | |
| s.set("color_scheme", new_scheme) | |
| s.set("theme", new_theme) | |
| sublime.save_settings("Preferences.sublime-settings") |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Corresponding Sublime Text keymap entry: toggle_theme_and_scheme_keymap_entry.json