Change specific expression color


#1

Hello, i want to know If it’s possible to change an specific word/expression in atom. Example:

In C++ grammar, the word “string” is gray/doesn’t have any color. I want to make It purple, just like other variable types, like int, float, etc.


#2

You can’t change the color of a word unless the grammar applies a class to it. This is the line in language-c.cson that applies the syntax--storage class to all of the variable types (but not string, because it’s not a core type in C). You have a couple of options. Neither of them is super-easy, and it will depend on how much this matters to you. If you pick one, I will tell you how to do it.

  1. You could make your own grammar that matches string and follows it with include: "source.cpp", but then (unless you did a whole lot more work) every instance of those six letters would get highlighted, including the ones inside quoted strings.
  2. You could download language-c locally, change line 729, and use the customized package to override the core language-c. This will prevent you from benefiting from new changes to the language-c package unless you keep your local git repo updated. Also, if you override a core package and make your own changes, you will have to remember that in case something goes wrong (so that you and anyone helping you can take that into account when troubleshooting).