Sublime Forum

Override any active color scheme with my own extension

#1

I made my own “color scheme” but only for one file type, and I defined my own scopes and colors for it. I want to have a main color scheme active (e.g. Mariana) but extend it with my own scheme.

What works for a specific scheme is placing my color scheme’s .sublime-color-scheme file into a subfolder in /Packages/ and renaming it to the current schemes name, e.g. Mariana.sublime-color-scheme - this applies Mariana first, and then adds my own scopes and colors on top.

But I want to turn this into an installable package eventually, so I want my extension to be applied to whichever scheme is currently active, without having to rename my .sublime-color-scheme file every time I change schemes. Can Sublime do this? If not, can I make my package rename the custom file upon every color scheme change?

0 Likes

#2

It’s not currently possible to one color scheme to extend another one; the only thing that’s possible is partially “overriding” (or perhaps “blending” would be a better term) as you mention in your original post.

So indeed you would have to have a plugin that creates an appropriate file based on the user’s color scheme. There are various edge cases there since it’s possible for there to be a global color scheme, any number of syntax specific color schemes and also project specific color schemes as well.

In addition it’s also worth pointing out that the number of possible color schemes is limitless, so trying to come up with a set of colors that will work for everyone is nigh on impossible.

For example, if you choose a light colored text, anyone with a light colored color scheme will find the color invisible, and ditto people with dark colored text. Or if someone has a color scheme centered around shades of purple and you use orange colors, it may not be pleasing.

There’s not really a good way around that sort of thing currently other than perhaps including sample color scheme rules in your documentation along with instructions on how to apply and adjust them manually, automatically creating the file but having configuration settings in your package that it uses to pick the colors, and things of that nature.

1 Like