color-scheme - 如何在 Visual Studio Code 中添加主题?

标签 color-scheme visual-studio-code

我最近下载了 VS code editor这真的很好。
但我在其中发现的唯一问题是颜色主题,我习惯于
monokai 颜色主题就像在崇高的文本中一样,我找不到编辑的方法
颜色主题或下载颜色主题只有 2 个选项:

  • 黑暗主题
  • 轻主题

  • 如何添加我自己的主题或复制现有主题,以便我能够
    按照我的意愿编辑配色方案?

    我设法更改了以下文件中的一些颜色,但仍然
    我不知道如何添加全新的主题:
    resources/app/client/vs/monaco/ui/workbench/native/native.main.css
    

    看起来颜色主题很快就会可用,它将成为插件系统的一部分

    visual-studio-code/suggestions/7756227-theme

    最佳答案

    Visual Studio Code 0.9.0 及更高版本

    有关于如何添加自定义主题的官方文档:https://github.com/Microsoft/vscode-docs/blob/0.9.0/release-notes/latest.md

    您需要一个 .tmtheme您要添加的主题的文件。您可以找到现有文件,例如在 GitHub 上,ColorSublime或者您可以定义自己的主题文件(例如使用 https://github.com/aziz/tmTheme-Editor )。

    找到后.tmtheme文件,您有两种方法可以基于它创建扩展名。

    选项 1:使用 Yeoman 生成器

  • 安装 node.js(如果你还没有安装)
  • 通过执行 npm install -g yo 安装 yo(如果您还没有安装)
  • 为代码安装 Yo 生成器:npm install -g generator-code
  • 运行 yo code并选择 New Color Theme
  • 按照说明操作(定义 .tmTheme 文件、主题名称、ui 主题等)
  • 生成器使用当前工作目录中的主题名称为您的扩展创建一个目录。

  • 选项2:自己创建目录
  • 使用您的插件名称(仅小写字母)创建一个目录。假设我们称之为 mytheme .
  • 添加子文件夹 themes并放置 .tmTheme里面的文件
  • 创建文件 package.json在扩展文件夹的根目录中,内容如下

    {        
        "name": "theme-mytheme",
        "version": "0.0.1",
        "engines": {
            "vscode": ">=0.9.0-pre.1"
        },
        "publisher": "me",
       "contributes": {
            "themes": [
                {
                    "label": "My Theme",
                    "uiTheme": "vs-dark", // use "vs" to select the light UI theme
                    "path": "./themes/mytheme.tmTheme"
                }
            ]
        }
    }
    

  • 最后将您的扩展添加到 Visual Studio Code

    将扩展文件夹复制到扩展目录。这是:
  • 视窗 %USERPROFILE%\.vscode\extensions
  • Mac/Linux $HOME/.vscode/extensions

  • 重启VSCode,在File -> Preferences -> Color Theme中选择新的主题

    Visual Studio 代码 0.8.0

    可以在 Visual Studio Code 0.8.0 中添加新主题(2015 年 8 月 31 日发布给内部人员 [成为内部人员:https://www.instant.ly/s/Y5nt1/nav#p/186a0])。

    安装 VSCode 0.8.0 或更高版本后,请执行以下操作以应用您自己的主题:
  • 下载 .tmTheme文件或创建自己的文件(例如使用 https://github.com/aziz/tmTheme-Editor )
  • 复制 .tmTheme文件到 %CODEFOLDER%/resources/app/plugins/vs.theme.starterkit/themes
  • 注册 .tmTheme文件在 %CODEFOLDER%/resources/app/plugins/vs.theme.starterkit/ticino.plugin.json通过为它添加一个条目,如下所示:

    {
        "id": "vs-theme-mynewtheme", // internal ID
        "label": "MyNewTheme",       // displayed name for the theme
        "uiTheme": "vs-dark",        // general UI appeareance (
                                     // "vs" for light themes, 
                                     // "vs-dark" for dark themes)
        "path": "./themes/myNewTheme.tmTheme" // file path 
    },  
    
  • 重启VSCode,在File -> Preferences -> Color Theme中选择新的主题
  • 关于color-scheme - 如何在 Visual Studio Code 中添加主题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30011737/

    相关文章:

    colors - 在 Gnuplot 中更改颜色,就像画廊中的颜色一样

    css - Sublime Text 3 - CSS 属性的配色方案

    python - Pylint 加载插件在 VS 代码中失败

    bash - 无法从 vscode 终端克隆

    python-3.x - 如何更改 ttk.Entry 插入光标颜色?

    intellij-idea - 如何安装 IntelliJ IDEA 7.0.x 的颜色主题

    与 Vundle 一起安装的 Vim 配色方案不会改变颜色

    visual-studio-code - 拆分编辑器 : Go to Definition opens a new tab in the current split even if the target is already open in another split

    node.js - 无法在 Windows 10 上使用 VS Code 调试 Node.js Google Cloud Functions(本地模拟器)

    visual-studio-code - 如何在 vs 代码或 jupyter 笔记本中为 julia 输入 latex 样式变量