How to refresh Sublime Text 3 workspace color schemes?
Asked Answered
B

3

10

When you save a project, Sublime Text will create a .sublime-workspace file. In this file, there is an array of buffers, and for each buffer there is a color_scheme property. This is set to whatever color scheme was chosen when the buffers and workspace were created.

I recently changed my theme and color scheme in my user settings file. How can I refresh all of my project's workspaces so that way it uses my new color_scheme provided in my user preference file without needed to edit each project's workspace file one-by-one?

Bog answered 8/4, 2015 at 1:52 Comment(3)
Did you try restart SublimeTheme? My theme is saved into Preferences > Settings - User, not workspace.Agulhas
My theme is saved there too. However, it looks like my theme settings are also saved for each workspace. So, the workspace files override my user preference file. Which means, I have to update all my workspace files.Bog
Try removing that setting from every workspace file, this way it will look up one level in the hierarchy tree, which is the user settings file I think.Agulhas
P
16

Expanding on the answer given by Tot you can do this for all views in all windows that are open by using a nested list comprehension (remember this is Python so we can be pretty flexible):

[ v.settings().erase("color_scheme") for views in [ w.views() for w in sublime.windows() ] for v in views ]

This way you don't have to run the command in each tab individually.

Paralysis answered 14/4, 2016 at 16:47 Comment(0)
E
6

The only way I found to reset tabs to user's chosen color scheme is to enter this in the console :

view.settings().erase("color_scheme")

This will reset the color scheme of the selected tab - unfortunately you'll have to do it for each tab. But it's still quicker than closing and reopening the tab.

I only have this issue with Sublime Text 3 on Mac OS X.

Source : https://www.sublimetext.com/forum/viewtopic.php?f=3&t=19310

P.S. : If you've just updated your color scheme file, you'll sometimes have to execute this command twice. Just type the up arrow in the console to write the last command again.

Expert answered 3/11, 2015 at 11:25 Comment(0)
A
1

Windows 10 AppData-related Solution

Please make sure that you are in a similar situation as me before trying this solution (see below). Steps:

  1. Note the language and package that the Error loading colour scheme reports (my case was: markdown and MarkdownEditing).
  2. Go to your AppData directory (type %AppData% in file explorer address bar).
  3. Open directory Sublime Text 3, or whatever your version is.
  4. Open the .sublime-settings file that matches the language from step 1.
  5. Remove any lines that refer to the package you noted from step 1.
  6. Remember that this file should be a properly formatted JSON file when you remove lines manually. Save this file and restart Sublime Text.

Background

I've decided to post here in case some of the python script solutions didn't work for you and your situation is similar to mine. I'm using GitHub to sync my Sublime Text AppData (Windows 10), in order to keep my workflow settings the same on multiple machines. Recently, I noticed that when I uninstalled a certain package on one of my machines, I accidentally merged some configuration files for that non-existent package on my other machine. This resulted in a persistent Error loading colour scheme, in particular for me when changing syntax to markdown (the package was MarkdownEditing for reference).

Antabuse answered 21/9, 2019 at 16:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.