Created
March 31, 2016 01:48
-
-
Save alecthomas/21cf0cc7e5e2a0f93d9b6401981cb1c6 to your computer and use it in GitHub Desktop.
Sublime plugin to toggle between light and dark themes
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 | |
import sublime_plugin | |
class DayAndNightCommand(sublime_plugin.ApplicationCommand): | |
def run(self): | |
s = sublime.load_settings("Preferences.sublime-settings") | |
if s.get("theme") == "Reverse Gravity.sublime-theme": | |
print("Switching to dark theme") | |
s.set("theme", "Gravity.sublime-theme") | |
s.set("color_scheme", "Packages/User/SublimeLinter/SwapOff (SL).tmTheme") | |
else: | |
print("Switching to light theme") | |
s.set("theme", "Reverse Gravity.sublime-theme") | |
s.set("color_scheme", "Packages/User/Espresso Soda (Custom).tmTheme") | |
sublime.save_settings("Preferences.sublime-settings") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment