I want to customize some colors for the editor in VS Code for the Go language. First, I want to start by changing the color for the packages:
<code>package main
</code>
<code>package main
</code>
package main
(That is, change the word “main” for example). By default it appears with the same color as the Types and I find it somewhat confusing.
So, I tried the following:
<code>{
"workbench.colorTheme": "Default Dark Modern",
"editor.minimap.enabled": false,
"github.copilot.enable": {
"*": true,
"plaintext": false,
"markdown": false,
"scminput": false,
"python": true,
"go": true
},
"editor.semanticTokenColorCustomizations": {
},
"editor.fontLigatures": false,
"editor.fontVariations": false,
"editor.tokenColorCustomizations": {
"[*Light*]": {
"textMateRules": [
{
"scope": "ref.matchtext",
"settings": {
"foreground": "#000"
}
}
]
},
"[*Dark*]": {
"textMateRules": [
{
"scope": "ref.matchtext",
"settings": {
"foreground": "#fff"
}
}
]
},
// I added this part
"[*Default Dark Modern*]": {
"textMateRules": [
{
"scope": "storage.type.package.go",
"settings": {
"foreground": "#c300ff"
}
}
]
}
}
}
</code>
<code>{
"workbench.colorTheme": "Default Dark Modern",
"editor.minimap.enabled": false,
"github.copilot.enable": {
"*": true,
"plaintext": false,
"markdown": false,
"scminput": false,
"python": true,
"go": true
},
"editor.semanticTokenColorCustomizations": {
},
"editor.fontLigatures": false,
"editor.fontVariations": false,
"editor.tokenColorCustomizations": {
"[*Light*]": {
"textMateRules": [
{
"scope": "ref.matchtext",
"settings": {
"foreground": "#000"
}
}
]
},
"[*Dark*]": {
"textMateRules": [
{
"scope": "ref.matchtext",
"settings": {
"foreground": "#fff"
}
}
]
},
// I added this part
"[*Default Dark Modern*]": {
"textMateRules": [
{
"scope": "storage.type.package.go",
"settings": {
"foreground": "#c300ff"
}
}
]
}
}
}
</code>
{
"workbench.colorTheme": "Default Dark Modern",
"editor.minimap.enabled": false,
"github.copilot.enable": {
"*": true,
"plaintext": false,
"markdown": false,
"scminput": false,
"python": true,
"go": true
},
"editor.semanticTokenColorCustomizations": {
},
"editor.fontLigatures": false,
"editor.fontVariations": false,
"editor.tokenColorCustomizations": {
"[*Light*]": {
"textMateRules": [
{
"scope": "ref.matchtext",
"settings": {
"foreground": "#000"
}
}
]
},
"[*Dark*]": {
"textMateRules": [
{
"scope": "ref.matchtext",
"settings": {
"foreground": "#fff"
}
}
]
},
// I added this part
"[*Default Dark Modern*]": {
"textMateRules": [
{
"scope": "storage.type.package.go",
"settings": {
"foreground": "#c300ff"
}
}
]
}
}
}
However, it did not produce any change in the editor. I suppose I should write the correct scope for this case but I don’t know where I can look for it (if it is possible to change this).