我正在创建自己的 Visual Studio Code 主题,我希望链接/URL 在 HTML 和 CSS 中拥有自己独立的颜色。从我读到的内容看来,这曾经是通过检测到的链接完成的,但现在应该使用 linkForeground。我在创建的 theme.json 文件中尝试了这两种方法,但似乎都不起作用。有谁知道如何在 Visual Studio Code .json 文件中自定义链接/URL 语法突出显示颜色?
这就是我尝试过的...
{
"name": "转到定义链接",
“范围”:“链接前景”,
“设置”: {
“前景”:“#4B83CD”
}
},
这是我上面引用的讨论之一。
https://github.com/Microsoft/vscode/issues/18378 https://github.com/Microsoft/vscode/issues/18378
这有两个部分:使用语法颜色 https://code.visualstudio.com/docs/extensions/themes-snippets-colorizers#_syntax-highlighting-colors设置语法中链接的颜色并使用工作台颜色 https://code.visualstudio.com/docs/extensions/themes-snippets-colorizers#_workbench-colors设置当用户将鼠标悬停在可点击链接上时的颜色。
要设置链接的语法颜色,您需要确定唯一的scope https://code.visualstudio.com/docs/extensions/themes-snippets-colorizers#_textmate-theme-rules链接并编写使用此范围的 TextMate 着色规则。例如,使用Developer: Inspect TM Scope
在 VS Code 中命令,我可以看到 cssurl()
链接的范围是variable.parameter.url.css
,所以我的主题是:
{
"type": "dark",
"tokenColors": [
{
"scope": [
"variable.parameter.url.css",
],
"settings": {
"foreground": "#f0f"
}
}
}
}
第二个比较容易;只需使用editorLink.activeForeground
颜色主题设置:
{
"type": "dark",
"colors": {
"editorLink.activeForeground": "#ff0",
...
},
"tokenColors": [ ... ]
}
当您将鼠标悬停在链接上时,这会更改链接的颜色。无法根据语言进行更改。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)