Sublime Forum

Sublime-syntax "Absolute color" independent of theme

#1

Hi,

I am attempting to create me own sublime-syntax file to colorize output from my build system and I wanted to know if in the the sublime-syntax file there is a way of applying a color to certain text independent of theme the user is running.

I am doing this because the output of my build will have errors and i always want the errors to be red in stead of using scope names and hoping the theme applies an appropriate color to the text.

?

0 Likes

#2

no, there is no way to control color solely from a syntax definition. The only possible way to do it would be if you set a scope like color.red and the color scheme would give that scope a red color. I guess you could make PRs to all the popular color schemes on Package Control, but there is no way to change the default ones that come with ST.

however, there is an alternative. You could just set the color scheme for the build output window to one of your choosing - perhaps even modify the current color scheme and add the color.red rule. You’ll need to create your own build target command though. http://docs.sublimetext.info/en/latest/reference/build_systems/configuration.html#bs-target-option

3 Likes

#3

You could also inspect the color scheme being used and select the scope name that specifies the color closest to red. This is what ST does behind the scenes for its minihtml popups (and phantoms).

Other packages resorted to modifying a color scheme by creating a copy with its specific scopes added, for example SublimeLinter or ColorHighlighter.

4 Likes