How to edit default dark theme for Visual Studio Code?

后端 未结 10 2077
执念已碎
执念已碎 2020-11-30 17:24

I\'m using Windows 7 64-bit.

Is there a way to edit default dark theme in the Visual Studio Code? In %USERPROFILE%\\.vscode folder there are only themes

10条回答
  •  心在旅途
    2020-11-30 18:06

    As others have stated, you'll need to override the editor.tokenColorCustomizations or the workbench.colorCustomizations setting in the settings.json file. Here you can choose a base theme, like Abyss, and only override the things you want to change. You can either override very few things like the function, string colors etc. very easily.

    E.g. for workbench.colorCustomizations

    "workbench.colorCustomizations": {
        "[Default Dark+]": {
            "editor.background": "#130e293f",
        }
    }
    

    E.g. for editor.tokenColorCustomizations:

    "editor.tokenColorCustomizations": {
        "[Abyss]": {
            "functions": "#FF0000",
            "strings": "#FF0000"
        }
    }
    // Don't do this, looks horrible.
    

    However, deep customisations like change the colour of the var keyword will require you to provide the override values under the textMateRules key.

    E.g. below:

    "editor.tokenColorCustomizations": {
        "[Abyss]": {
            "textMateRules": [
                {
                    "scope": "keyword.operator",
                    "settings": {
                        "foreground": "#FFFFFF"
                    }
                },
                {
                    "scope": "keyword.var",
                    "settings": {
                        "foreground": "#2871bb",
                        "fontStyle": "bold"
                    }
                }
            ]
        }
    }
    

    You can also override globally across themes:

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": [
                    //following will be in italics (=Pacifico)
                    "comment",
                    "entity.name.type.class", //class names
                    "keyword", //import, export, return…
                    //"support.class.builtin.js", //String, Number, Boolean…, this, super
                    "storage.modifier", //static keyword
                    "storage.type.class.js", //class keyword
                    "storage.type.function.js", // function keyword
                    "storage.type.js", // Variable declarations
                    "keyword.control.import.js", // Imports
                    "keyword.control.from.js", // From-Keyword
                    //"entity.name.type.js", // new … Expression
                    "keyword.control.flow.js", // await
                    "keyword.control.conditional.js", // if
                    "keyword.control.loop.js", // for
                    "keyword.operator.new.js", // new
                ],
                "settings": {
                    "fontStyle": "italic"
                }
            }
        ]
    }
    

    More details here: https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide

提交回复
热议问题