I use ST3 for prose, with a modified Monokai color scheme. I want to start using ST also for tinkering with HTML. I’m trying to associate a different color scheme for html files (and leave my custom Monkai for my usual syntax, which is txt files). I can’t figure out how to make it so that when I open an html file, I get that new color scheme (let’s say it’s Pastel on Dark, for the sake of example). Any help appreciated.
With an HTML file open, use
Preferences > Settings - Syntax Specific to open the settings for HTML files. The window will look like regular preferences do, except that the settings that you add on the right hand side will be applied only to HTML files, and the settings there override the defaults.
In those settings you can use the
color_scheme setting to apply a different color scheme for HTML files.
Thanks, ON. I was trying to do that. I’m stuck in a bit of a loop now, though. I was trying to apply the legacy scheme called “Pastels on Dark” but mistyped it as “Pastel on Dark.” It didn’t recognize that scheme, of course, because of my typo. So I switched to applying Mariana with my html, and saving the html color scheme that way, but now every time I start up, it tells me “pastel on dark” was not found and is unloadable. Right, I get that, but I changed that setting…the “HTML.sublime-settings” file in my User folder consists of this:
Nothing in my startup routine, as far as I know, is asking for “pastel on dark” but I’m still getting the error on startup, and my html fles are all just black test on white background. I’ve screwed up somewhere, but can’t tell where.
I would look to see if you have any HTML files open that think they’re using that color scheme and then close and re-open them.
That did it. I had a file open in a window I’d forgotten about, THANKS. So Mariana works. A follow-up question, though: I would actually like to use a legacy scheme called Pastels on Dark for my html, but I can’t get that to work. Should I put underscores between the words? Case sensitive? Is the fact that it’s a legacy scheme complicating things?
The value you use for the setting is the name of the file that defines the color scheme (and is indeed case sensitive).
When using color schemes in the new format, you would set the value to just the name of the file, such as
If the color scheme is in the older
tmTheme format, you need to specify the whole resource name, including the name of the package.
Presuming that you’re referring to the legacy color scheme that ships with Sublime, that would make the value of the setting
"Packages/Color Scheme - Legacy/Pastels on Dark.tmTheme".
If you’re unsure, something you can do is use the command in the command palette to interactively select the color scheme that you want to use, then look in your
Preferences.sublime-settings file and copy it to the
HTML.sublime-settings file (in this case).
Excellent, thanks very much…again!