问题描述
我想把这个自定义颜色定义映射到 vscode 夜猫子颜色定义中
但我不知道如何将这些映射到 vscode settings.json
希望大家多多帮助
我在 Visual Studio 代码中使用了 this Night Owl theme。
自定义颜色定义:
{
id: "night-owl",name: "Night Owl",highlights: {
background: "#011627",text: "#abb2bf",variable: "#82AAFF",attribute: "#F78C6C",deFinition: "#82AAFF",keyword: "#c792ea",operator: "#c792ea",property: "#fff",number: "#F78C6C",string: "#ecc48d",comment: "#717a8a",Meta: "#7fdbca",tag: "#7fdbca",},
有了这个,我可以把我的 vscode 夜猫子主题变成这样
解决方法
对于背景,如果您必须在 "editor.background"
下设置 "workbench.colorCustomizations"
。例如,如果您将以下段添加到用户的 settings.json
文件中,它将更改背景、前景、活动前景和侧边栏背景。
"workbench.colorCustomizations": {
"[Night Owl]": {
"editor.background": "#ff0000","editor.foreground": "#000000","activityBar.foreground": "#00b7ff",//for activity foreground
"sideBar.background": "#151616" //for sidebar background
}
},
要自定义代码,您必须使用 "editor.tokenColorCustomizations"
。例如,下面的部分将自定义所有评论和功能。
"editor.tokenColorCustomizations": {
"[Night Owl]": {
"comments": "#717272","functions": "#00b7ff",}
}
希望你有这个想法。如需更多信息,请查看 vscode color theme 部分和 reference 页面。您也可以查看Night Owl's readme file。