Why logical operators are not colored in one dark syntax theme


#1

Hi,

I’m using one dark theme and I really like it.

But I’ve noticed all the logical operators ( &&, ||, !, and, or ...) are not colored. I tried both Ruby and Javascript.

I’m not sure if it’s designed like that or there’s some settings for that?

Thanks


#2

I’m not sure if it’s designed like that

It seems like that: atom/one-dark-syntax#44

You can add this to your stylesheet:

atom-text-editor::shadow {
  // Color all operators
  .keyword.operator {
    color: red;
  }
  // Color logical operators in Ruby, Javascript
  .ruby, .js {
    .keyword.operator.logical {
      color: red;
    }
  }
}

keyword.operator.logical in javascript since v0.99.0 (atom/language-javascript#225)


#3

Hi,

I have a similar question … I like the Monokai theme for revising/editing my MATLAB code, but I was wondering if there was a way to make the logical operator always pink and numbers always purple, because when they aren’t separated by a space, they take the same color as text (or variable) that precedes them.

Thanks’


#4

Try with another theme. It should behave the same way, because what you’re seeing is a regular expression issue. There are several MATLAB language packages. Which one are you using? You might find that one of the others has better designed regular expressions.


#5

In Atom version 1.28.2 I see the following error while adding that to the stylesheet:

Starting from Atom v1.13.0, the contents of atom-text-editor elements are no longer encapsulated within a shadow DOM boundary. This means you should stop using :host and ::shadow pseudo-selectors, and prepend all your syntax selectors with syntax–. To prevent breakage with existing style sheets, Atom will automatically upgrade the following selectors:

atom-text-editor::shadow .keyword.operator => atom-text-editor.editor .syntax–keyword.syntax–operator
Automatic translation of selectors will be removed in a few release cycles to minimize startup time. Please, make sure to upgrade the above selectors as soon as possible.

So the correct stylesheet addition is:

atom-text-editor.editor .syntax--keyword.syntax--operator {
  color:crimson;
}