Sublime Forum

Set theme/color scheme in memory

#1

Is there a way to set the global theme and color scheme in memory, without having to make changes to the preferences file? In other words, an API call on the window to set them. If not, can one be added to an upcoming version of ST? My plugin Solarized Toggle could greatly benefit from this behavior.

0 Likes

#2

For a temporary (view specific) change:

view.settings().set('color_scheme', 'Packages/Color Scheme - Default/Solarized (Light).tmTheme')

…and for a global change:

sublime.load_settings('Preferences.sublime-settings').set('color_scheme', 'Packages/Color Scheme - Default/Solarized (Light).tmTheme')
0 Likes

#3

Don’t forget sublime.save_settings('Preferences.sublime-settings') even though I’m not particularly sure if it’s actually necessary. You should test it.

0 Likes

#4

True, but you only need to save the settings if you want the changes to be persisted. The change in settings is immediately effective, regardless if you save them or not.

0 Likes