Sublime Forum

Linting Colors

#1

Is there a way to customize the colors of warnings and errors with the Sublime Linter package - specifically for jshint? It will be nice to be able to customize for other SublimeLinter language packages too. Any advice is appreciated. Thank you.

0 Likes

#2

Package like SublimeLinter just add so called regions of certain scopes such as markup.error or markup.warning. You need to modify your color scheme to change the colors associated with these scopes.

If your color scheme is in TextMate tmTheme format, you need to copy, modify and select it.

If it is a sublime-color-scheme you can create a file of the same name within your user file, containing just the rules to modify warnings and errors. This file is merged with the original one by ST when loaded.

0 Likes

#3

Sure. It’s even easier than @deathaxe’s approach, although that also works but not per linter. All linters take a “styles” setting: http://www.sublimelinter.com/en/stable/linter_settings.html#styles

So, you would edit your SublimeLinter settings to look somewhat like this:

{
    "linters": {
        "jshint": {
            "styles": [
                {
                    "scope": "region.bluish",
                    "types": ["warning"]
                },
                {
                    "scope": "region.redish",
                    "types": ["error"]
                }
            ]
        }
    }
}

This example makes jshint warnings blue and errors red. (This assumes you have ST 3176, the latest stable 3.1).

0 Likes

#4

This just allows to assign custom scopes, which still relies on the predefined colors in a color scheme. If you want to use customized colors, which do not yet exist, you need to edit the color scheme.

0 Likes

#5

This is true, but it’s not clear from the OP that that level of control is required. It almost never is (do you want “red” or do you really need E82C0C instead of CF270A?), so I didn’t default to that explanation. Also, you need that tidbit about linter settings to be able to set different styles for different linters.

1 Like