Getting color of comment for marker


I am developing a package that changes the appearance of source code given some dynamic criteria. One of these changes is to make line appear as inactive - effectively changing the color to the one of a comment.

I managed to create a marker and add class to given line. However, I couldn’t find a way to set color as comment (preferably as variable). In I see list of variables for various language entities, but comment is missing.


Beware, most syntax themes use hardcoded colors, so relying on less variables is unlikely to work.

On way would be to affect a comment class to your line, hoping that the syntax theme doesn’t use a more specific selector.

Another way, if you use javascript, is to evaluate at runtime the styles of a comment token. That’s what we do in the minimap (as we use a canvas we can’t rely on CSS to apply the colors).