Last active
December 26, 2015 23:09
-
-
Save timurkhafizov/7228084 to your computer and use it in GitHub Desktop.
Cycle between Sublime themes and color schemes.
Based on http://stackoverflow.com/questions/13121687/keyboard-shortcut-to-change-color-scheme-in-sublime-text-2
This file contains 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
Show hidden characters
# Can be accessed via Preferences > Key Bindings - User | |
[ | |
{ | |
"keys": ["super+shift+o"], "command": "toggle_color_scheme", | |
"args": | |
{ | |
"color_scheme_1": "Packages/Solarized Color Scheme/Solarized (dark).tmTheme", | |
"color_scheme_2": "Packages/Solarized Color Scheme/Solarized (light).tmTheme", | |
"theme1": "Sodarized Dark 3.sublime-theme", | |
"theme2": "Sodarized Light 3.sublime-theme" | |
} | |
} | |
] |
This file contains 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
# Create new plugin via Tools > New Plugin... | |
import sublime, sublime_plugin | |
class ToggleColorSchemeCommand(sublime_plugin.TextCommand): | |
def run(self, edit, **args): | |
scheme1, scheme2 = args["color_scheme_1"], args["color_scheme_2"] | |
theme1, theme2 = args["theme1"], args["theme2"] | |
settings = sublime.load_settings('Preferences.sublime-settings') | |
current_scheme = settings.get("color_scheme") | |
current_theme = settings.get("theme") | |
new_scheme = scheme1 if current_scheme == scheme2 else scheme2 | |
new_theme = theme1 if current_theme == theme2 else theme2 | |
settings.set("color_scheme", new_scheme) | |
settings.set("theme", new_theme) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment