Sublime Forum

Change text color regardless of syntax?

#1

Hi,

Is there currently a way or a plugin that would let you change the color of a fragment of code regardless of syntax?
For example, I have a function sitting in the middle of my file that I use rarely. So I would like to change the color of the function along with it content to all blue so that it doesn’t distract me (i know about folding but this is just an example).
Another example: I could mark all “finished” content of the file with, say, yellow and only concentrate on the parts that need more work. Or mark something with pink for a screenshot…

Is this possible?

0 Likes

#2

It’s possible to change the background color or outline text using the view.add_regions method. However, you can only use colors defined in your color scheme, and you have to know what “scope” will give what color. Of course, you can edit your color scheme and add new scope and color combinations to make it easier.

I don’t know of any plugins that can do this, but you can play around with it:

  1. Select the text you want to color
  2. Open the Sublime Text console (View menu -> Show Console)
  3. Paste the following: view.add_regions('a_unique_id', view.sel(), 'comment') - here you can change comment for other scopes for different colors
  4. Press Enter
  5. Move the selection away and see the results
2 Likes

#3

 

Check out my post @
##Text area illumination (quasi-permanent highlighting)

2 Likes