Picking a specific language color

I have noticed that different languages use different colors. I currently have the One Dark theme as both UI Theme and Syntax Theme.

I like how it uses the colors in C++, however I can’t find how I can make those colors standard for the other languages as well.

How do I pick out the colors that it uses for C++? Thanks.

Syntax highlighting has two stages: a language package assigns scopes to text ranges in the editor, and a theme assigns colours to scopes. Language packages use roughly the same set of scopes, so themes will look decent on most languages. Themes can also add specialised colours for particular languages.

If you want to add the C++ colour palette to other languages, you’d need to work out

  • What scopes in C++ the one-dark theme is colouring the way you like
  • What scopes are being used in other languages instead
  • Which colours to change to get the effect you want

Use the Editor: Log Cursor Scope command to show the scope at the cursor.

You can apply the changes by writing them in your stylesheet (this will override the theme). You can find the scopes to target based on the one-dark package scopes. Note that the scopes in the logging command have scope-- prepended to each part when used in a stylesheet.

1 Like

Thanks a lot!