Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Theme and colorscheme keybind toggle
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)
"keys": ["super+k", "super+c", "super+l"],
"command": "toggle_color_scheme",
"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