是不是可以使用JavaScript或TypeScript而不是JSON来创建VS Code主题扩展?

huangapple go评论73阅读模式
英文:

Is it possible to create a VS Code theme extension using JavaScript or TypeScript instead JSON?

问题

我正在为VS Code创建一个主题扩展。我想知道是否可以使用JavaScript或TypeScript文件而不是JSON文件。我不喜欢整个主题都在一个庞大的JSON文件中,我觉得这很混乱和复杂,而且不支持注释。

英文:

I'm creating a theme extension for vs code. And I wanted to know, if it's possible to use JavaScript or TypeScript files instead of a JSON file. I don't like that the whole theme is inside one huge JSON file. I find it very messy and complicated to handle. And also, it does not accept comments.

答案1

得分: 0

以下是翻译好的部分:

据我所知,主题定义文件需要采用JSON格式(另请参阅https://code.visualstudio.com/api/extension-guides/color-theme#create-a-new-color-theme)。

> 我不喜欢整个主题都在一个巨大的JSON文件中。我觉得这样非常混乱和复杂。而且,它不接受注释。

然后,您可以编写一个脚本/脚本,用于生成最终的JSON文件。有几个主题扩展可以实现这一点。这样做还有其他好处,包括能够进行计算以生成修改后的颜色版本,例如根据另一种颜色的修改来定义一种颜色。

英文:

As far as I know, the theme definition file needs to be in JSON format (see also https://code.visualstudio.com/api/extension-guides/color-theme#create-a-new-color-theme).

> I don't like that the whole theme is inside one huge JSON file. I find it very messy and complicated to handle. And also, it does not accept comments.

Then you can write a script / scripts that produce the final JSON file. There are several theme extensions that do this. There are other benefits to doing this, including then being able to do calculations to produce modified versions of colours, such as defining one colour in terms of modifications on another colour.

huangapple
  • 本文由 发表于 2023年6月5日 01:54:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76401712.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定