How to edit default dark theme for Visual Studio Code?

后端 未结 10 2060
执念已碎
执念已碎 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 17:54

    Any color theme can be changed in this settings section on VS Code version 1.12 or higher:

     // Overrides colors from the currently selected color theme.
      "workbench.colorCustomizations": {}
    

    See https://code.visualstudio.com/docs/getstarted/themes#_customize-a-color-theme

    Available values to edit: https://code.visualstudio.com/docs/getstarted/theme-color-reference

    EDIT: To change syntax colors, see here: https://code.visualstudio.com/docs/extensions/themes-snippets-colorizers#_syntax-highlighting-colors and here: https://www.sublimetext.com/docs/3/scope_naming.html

    0 讨论(0)
  • 2020-11-30 17:57

    I came here to find a way to edit the theme, but could not find it on my Mac. After a deep dive, finally I found the install place:

    ~/.vscode/extensions

    All extensions in there!

    0 讨论(0)
  • 2020-11-30 17:58

    The simplest way is to edit the user settings and customise workbench.colorCustomizations

    If you want to make your theme

    There is also the option modify the current theme which will copy the current theme settings and let you save it as a *.color-theme.json JSON5 file

    0 讨论(0)
  • 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

    0 讨论(0)
  • 2020-11-30 18:08

    The file you are looking for is at,

    Microsoft VS Code\resources\app\extensions\theme-defaults\themes

    on Windows and search for filename dark_vs.json to locate it on any other system.


    Update:

    With new versions of VSCode you don't need to hunt for the settings file to customize the theme. Now you can customize your color theme with the workbench.colorCustomizations and editor.tokenColorCustomizations user settings. Documentation on the matter can be found here.

    0 讨论(0)
  • 2020-11-30 18:09

    The docs now have a whole section about this.

    Basically, use npm to install yo, and run the command yo code and you'll get a little text-based wizard -- one of whose options will be to create and edit a copy of the default dark scheme.

    0 讨论(0)
提交回复
热议问题