I use multiple windows of Sublime Text at once and would like to set each one to a different color theme. By default, changing the 'color preferences' changes them for all open windows.
Note it is possible to set the color scheme for a single window using a 'project settings' file (which suggests it is possible in general), but then the folder must be opened via the 'project settings' (and not just opening the folder).
How can I (programmatically or via the app) set a separate color scheme for a single SublimeText window?
Sublime Text 3 has a number of pre-installed themes that can be enabled by clicking on “Preferences” in the top bar, then clicking “Color Scheme”. Click on “Preferences” in the top bar, then click “Color Scheme”. Next, a box will appear at the top of the window, with a few options.
Changing the selection colour in Sublime Text 3 Open the command palette with ⌘+⇧+P on mac iOS (for windows/linux Ctrl + Shif + P) and type prv to get the PackageResourceViewer options. Choose Open Resource >> Color Scheme – Default >> and choose your theme file to edit.
You can do this with a small plugin. Create a new file with Python syntax, and the following contents:
import sublime_plugin
class ChangeWindowColorSchemeCommand(sublime_plugin.WindowCommand):
def change_scheme(self, scheme):
for view in self.window.views():
view.settings().set("color_scheme", scheme)
def run(self):
message = 'Enter path to color scheme:'
path = 'Packages/Color Scheme - Default/Monokai.tmTheme'
self.window.show_input_panel(message, path, self.change_scheme, None, None)
Save the file in your Packages/User
folder (accessible via Preferences -> Browse Packages...
) as change_window_color_scheme.py
. You can trigger the plugin in two ways - from the console, and via a key binding. To run it via the console, open the console with Ctrl` and enter
window.run_command('change_window_color_scheme')
An input panel will open at the bottom of the window, where you can enter the path to the color scheme you want to use. The default value is Monokai, but you can change that in the plugin source if you want. Once you enter the path, hit Enter and all the files in the current window will use that color scheme.
To create a key binding, open Preferences -> Key Bindings-User
and add the following:
{ "keys": ["ctrl+alt+shift+s"], "command": "change_window_color_scheme" }
If the file is empty, surround the above with square brackets [ ]
. Save the file, and you can now trigger the plugin using CtrlAltShiftS, or whichever key combination works best for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With