Created
March 8, 2014 12:27
-
-
Save andresbravog/9429793 to your computer and use it in GitHub Desktop.
Theme and colorscheme keybind toggle
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
import sublime, sublime_plugin | |
class ToggleColorSchemeCommand(sublime_plugin.TextCommand): | |
def run(self, edit, **args): | |
s = sublime.load_settings("Preferences.sublime-settings") | |
options = args['options'] | |
if options[0]: | |
current_scheme = s.get("color_scheme", options[0]['color_scheme']) | |
current_theme = s.get("theme", options[0]['theme']) | |
current_option = s.get("color_scheme_option", -1) | |
next_option = current_option + 1 | |
if next_option >= len(options): | |
next_option = 0 | |
if options[next_option]['theme']: | |
s.set('theme', options[next_option]['theme']) | |
if options[next_option]['color_scheme']: | |
s.set('color_scheme', options[next_option]['color_scheme']) | |
s.set('color_scheme_option', next_option) | |
sublime.save_settings("Preferences.sublime-settings") |
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
[ | |
{ | |
"keys": ["super+k", "super+c", "super+l"], | |
"command": "toggle_color_scheme", | |
"args":{ | |
"options": [ | |
{ | |
"color_scheme": "Packages/User/Flatland Monokai (SL).tmTheme" , | |
"theme": "Spacegray.sublime-theme" | |
}, | |
{ | |
"color_scheme": "Packages/User/Eiffel (SL).tmTheme", | |
"theme": "Spacegray Light.sublime-theme" | |
} | |
] | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment