Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode - How do I change the color of constants only in a javascript file?

With the recent update to vscode, I can not for the life of me find the setting to revert this back to the old color. Seems like it's all constants that were changed to this green color, while regular variables stayed the same. Thanks

enter image description here

like image 917
Jeff Avatar asked Oct 19 '25 02:10

Jeff


2 Answers

Not sure how to do it only for .js files, but this setting changes only constants and not all declarations. Paste this inside your VsCode settings.json

"editor.tokenColorCustomizations": {
        "textMateRules": [
          {
            "scope": "variable.other.constant",
            "settings": {
              "foreground": "#f5f5f5"
            }
          }
        ]
    },
like image 98
Omar Omeiri Avatar answered Oct 22 '25 03:10

Omar Omeiri


Added this to settings.json for the theme:

"editor.semanticTokenColorCustomizations": {
    "enabled": true, // enable semantic highlighting for all themes
    "rules": {
        "*.readonly": { "foreground": "#9cdcfe" },
        "*.declaration": { "foreground": "#9cdcfe" }
    }
}
like image 34
Jeff Avatar answered Oct 22 '25 05:10

Jeff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!