Is it possible to change the color ot text from javascript?

I want to create an extension that checks the document and makes unused variables gray.

Logic seems pretty simple:

  • fetch all variables
  • count them
  • make the once with only one occurrence gray

But I don’t if it’s possible to change the color? The rest is just simple calculations.

There isn’t currently, but this is a good suggestion. We currently have other requests for some way of adding decorations / marks to the editor, and I think this would fall into that category. I will consider this a feature request alongside that!