Is there a way to change the color of a single character or word?


#1

More than one case transpires where I need a character, like & in &str, to have its color changed, but I only know how to change its LESS class’s color, which also changes operators like +, >, etc. There are other words that, as far as Atom knows, belong in classes, yet are not part of the same theoretical group. I do not know enough to change everything for everyone’s sake, so I was wondering, since Atom is a hackable editor, if I can make these tiny changes for myself.

Examples that I desire:

  • &'s default is assigned to the operator class’s color.
  • If & is followed by regular letters then & is assigned another color.
  • If & is followed by another & then && is assigned to the boolean class’s color.

A few other words I want to customize:

  • Boolean operators such as and and or.
  • Integer types such as i32 and i64.

This would be a trivial change for Atom developers, but I am only learning my first language, so I am an ultra scrub. If you want me to do it myself instead, please point me in the right direction.


#2

For syntax coloring, there is only a means of changing colors for classes. You can update the grammar for the language you’re using to differentiate … but, so far as I know, there isn’t a method of targeting a single character.

/cc @abe @simurai


#3

Except for the ::first-letter selector I do not know about any methods to targets a specific character (if there was one, the amount of annoying text animations on the web would have been much higher).

Looks the only way is to extend/modify the grammar to catch these specific cases and decorate them with different scopes.