0
votes

I am creating a language extension for vscode to describe a language where some of the syntactic elements refer to specific colors. I would like to color those elements in those colors, regardless of what theme is being used, and without having to require the user to select my specific custom theme instead of their own preference for everything else. Is there any way to do this within the existing language and theme definition system?

My fallback solution would be something like https://github.com/KamiKillertO/vscode-colorize/ which runs outside the syntax system to dynamically evaluate the code and then apply decorators to it, but this is very much overkill for my needs where I could define the text to highlight with simple match patterns.

1
what if the color specified is similar to the theme background color: text is "gone" - rioV8
@rioV8 I would be setting both foreground and background colors, and the ones that match the theme background color are fine. - Sparr

1 Answers

0
votes

Similar to your other question, this is not possible. Colorisation is a combination of a single set theme + any user customisation.

I had a similar need in my language extension (ANTLR) where certain elements exist, that no other language has. So I needed special colorisation for them. However, the identification of such elements is based on a dynamic lexer, which assigns a scope to that element. And only those themes which define a color for that scope have an effect. So, the only solution is that users use your special theme for such special elements or they are not highlighted, other than what the default is.