Sublime Forum

Request: ability to edit color scheme in editor's settings

#1

I’d like to make some minor changes to the active color scheme. The current method is a bit hacky, it’d be great to be able to customize color scheme from within the editor’s settings, something like this:

"editor.colorSchemeCustomizations": {
    "scope": "text.html.basic entity.other.attribute-name.html",
    "settings": {
        "foreground": "#C792EA",
        "fontStyle": "Italic"
    }
}
1 Like

#2

Something like this is already possible, at least if you’re a licensed user and use one of the recent development builds; if not then you will have to wait for the next stable build to land.

The new dev builds introduced a new color scheme format called sublime-color-scheme that are a JSON version of tmTheme format that used to be used. One of the features that this brings is the ability to create partial overrides for color schemes in the same way as is currently possible for other Sublime resources.

For example, what you outlined above can be achieved by creating a file with the same name as your color scheme in your User package with contents like the following (for me, that’s Packages/User/Monokai.sublime-color.scheme):

{
    "rules":
    [
        {
            "name": "Tag attribute",
            "scope": "entity.other.attribute-name",
            "foreground": "var(yellow2)",
            "font_style": "italic"
        },
    ]
}

This is almost exactly what you outlined above, only in a different file. Arguably this is more “Sublime-like” than doing the same thing in settings as you outlined above since other Sublime resources can be augmented in the same way. Note also that the color_scheme setting isn’t global and can be changed per-tab, so at the very least if this was done in one file it would need to have keys to say what color scheme it applies to since there’s no guarantee that the colors chosen would make sense otherwise.

An example of it in operation is the following modification being made to the Monokai.sublime-color-scheme, except that the italic style is applied both times because I forgot and just realized it now):

7 Likes

#3

I use the latest stable, I don’t use dev builds, so I wasn’t aware of this feature. It’s great that there’s one now. I’m also wondering if there’s a feature coming up that will make it possible to natively customize editor’s settings, like for example padding in the sidebar folder tree?

1 Like

#4

Themes are more complex than color schemes, but you should look at the docs at http://www.sublimetext.com/docs/3/themes.html. I would recommend reading the first few sections to understand how they work and the syntax.

After that, you can jump to http://www.sublimetext.com/docs/3/themes.html#customization. And finally the elements in the side bar http://www.sublimetext.com/docs/3/themes.html#elements-side_bar.

1 Like

#5

Padding in the side bar and others are no “native editor settings”. Visual settings are always theme or color scheme related and therefore need to be applied via the active sublime-theme or sublime-color-scheme files, which are nothing else than a JSON files. Moving those settings to the main preferences might cause unpredictable issues with the themes and the way their authors intent different controls to look like.

1 Like

#6

For example, I want to change the padding between folders and files in the sidebar (see image below). In order to do that now, I need to install resource viewer package, open default.theme-sublime (or something), locate the sidebar settings and change the padding. I’d like to be able to just go to sublime settings and add something like this, which would override default settings:

"editor.sidebar": {
    "file_tree": {
        "padding": [16, 2, 2, 16]
    }
}

1 Like

#7

not true

http://www.sublimetext.com/docs/3/themes.html#customization

Users can customize a theme by creating a file with new rules that will be appended to the original theme definition.
To create a user-specific customization of a theme, create a new file with the same filename as the theme, but save it in the Packages/User/ directory.

2 Likes