Search code examples
c#sublimetext3

Sublime text 3 - Colouring specific characters C#


(Pre-Warning UK spelling)

Hi all, I'm trying to change my syntax colours on Sublime Text 3 I've had a google and haven't found much that i can make sense of. What I'm looking for is to make specific characters a different foreground colour. So for example

string[] name = {"Jack","James","...","John"};

My hope is that I could change the " character specifically to a different colour. So rather than the "Jack" all being in green I would have the " in a Dark Red and the Jack in Yellow. I have already got the whole thing in yellow I would just like to if at all possible change the " into red.

I'm using .sublime-colour-scheme extension if that is any help.

Any help would be great.


Solution

  • The scopes you're looking for are punctuation.definition.string.begin.cs and punctuation.definition.string.end.cs. If you want to color all quotes in any language, just drop the .cs at the end of each. So, the rule in your .sublime-color-scheme file would be like so:

    {
        "name": "String quotes",
        "scope": "punctuation.definition.string.begin, punctuation.definition.string.end",
        "foreground": "#8A0F11" // Feel free to change this to another deep red
    },