How do I modify rust-analyzer's text color?

Hi guys, I am using the vscode Rust extension rust-analyzer

I am using a third party theme and on top of that I have made my own custom color text theme inside settings.json in vscode:

        "[Bearded Theme Oceanic]": {
            "textMateRules": [
                  "scope": "string.quoted.double.rust",
                  "settings": {
                    "foreground": "#d790f8",

        //"comments": "#1de2769c"

However the issue is that because of the extension "rust-analyzer", this hijacks my custom text color theme after it has finished performing analyzing.

I could add this:

"[rust]": {
    "editor.semanticHighlighting.enabled": false

but then the third party text colors would then be different.

I was wondering if there was a way to modify rust-analyzer's default colors or something?

The problem is that with semantic highlighting, the appropriate token type is just a semantic token string:


(This window can be opened with the Developer: Inspect Editor Tokens and Scopes action.) You can see the overridden custom string.quoted.double.rust rule there at the bottom.

(The meta.embedded.assembly token type showing up probably isn't intended...)

It's worth noting also that editor.semanticTokenColorCustomizations doesn't support per-language configuration, but it does support per-theme configuration.


See also r-a's response here:

(This was probably you?)

1 Like

yep I just got his response thanks

Please let people know when you post a question multiple places.

1 Like


1 Like

I asked the other guy on github (and other places) but I wanted to also ask you:

I am thinking that It's probably better if I just modify all the "purple" text to something different rather than me just having to modify individual stuff (such as structs etc) to a different color property.

See how there are multiple occurrences of the "purple" text color, but they are all for different things?

So I wanted to know mate is it possible to modify all of the text using purple and to modify it a bit?

I would imagine the theme would have a set of different text color properties so I am not sure how I would modify that?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.