If line begins with X then text colour red

Anyone know how to do this? I’d like to have three colour states for lines that begin with either X, Y or Z. I only have an iPhone and find json hard to work with on this device. Thanks in advance

That can certainly be done with a custom syntax definition.

I highly recommend a JSON editor, especially if working on the phone. Jayson is a good one.

You can start with a syntax close to what you want (Markdown, or whatever) and export it. You would need to and three “patterns” that identify your lines using regex (something like ^X.* to find lines starting with X)…and have that scope matched to the colors you want.

Something like:

  {
    "match": "^X.*",
    "exclusive": true,
    "comment": "Lines starting with X",
    "captures": {
      "1": {
        "scope": "color.red"
      }
    }
  }

You can look in an exported theme for the available color. scopes in the default themes.

1 Like