Skip to content

Instantly share code, notes, and snippets.

@lyntco
Last active August 29, 2015 14:03
Show Gist options
  • Save lyntco/332319ed206e9cb552b5 to your computer and use it in GitHub Desktop.
Save lyntco/332319ed206e9cb552b5 to your computer and use it in GitHub Desktop.
toggle color scheme
[
{ "keys": ["ctrl+super+h"], "command": "toggle_color_scheme",
"args": {
"dark_color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
}
}
]
import sublime, sublime_plugin
class ToggleColorSchemeCommand(sublime_plugin.TextCommand):
def run(self, edit, **args):
light_scheme = "Packages/User/Solarized (Light) (SL).tmTheme"
dark_scheme = args["dark_color_scheme"]
settings = sublime.load_settings('Preferences.sublime-settings')
current_scheme = settings.get('color_scheme')
if current_scheme == light_scheme:
settings.set('color_scheme', dark_scheme)
else:
settings.set('color_scheme', light_scheme)
sublime.save_settings('Preferences.sublime-settings')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment