【发布时间】:2020-11-11 23:53:37
【问题描述】:
我正在尝试让内置颜色选择器与 json (webmanifest) 文件一起使用,就像它与 vscode 自己的 settings.json 文件一起使用以在十六进制值旁边显示内联颜色块一样。
上一个帖子建议创建一个架构并在此架构中使用format: color。我已经尝试了 settings.json 中 https://code.visualstudio.com/docs/languages/json 文档中的示例,虽然它在我的 webmanifest 文档中提供了智能感知代码,但它仍然不显示颜色值。
"json.schemas": [
{
"fileMatch": ["*.webmanifest"],
"url": "https://json.schemastore.org/web-manifest",
"properties": {
"theme_color": {
"format": "color"
}
}
}
]
我找不到 vscode 的内置 json 架构来查看它是如何在那里完成的。任何帮助将不胜感激。汤姆
更新
这在包含 type:object 对之后有效。不过还有很多工作要做。
"json.schemas": [
{
"fileMatch": ["*.webmanifest"],
"schema": {
"type": "object",
"properties": {
"theme_color" : {
"type": "string",
"description": "toolbar colour: hex only",
"format": "color-hex"
}
}
}
}
]
【问题讨论】:
标签: json visual-studio-code color-picker