Sublime Forum

How to have different background color for blocks or functions?

#1

As the source code increases (in my case Lua), with several dozens of functions, it would be very interesting if each function had a different background color visually.
This would greatly facilitate visual navigation and the quick recognition of which part of the code is currently being viewed, without the need to read each part, like this:


Any plugin that does that?

2 Likes

#2

There is currently no way to do this effectively and aesthetically. Color schemes are done by scopes. One would have to create syntaxes that scope each entire function with a different scope that could be colored differently. That would require you to write a cumbersome syntax file for every language you’d want to see this behavior in.

The alternative is to use regions, but in almost every case, that would be awful. The best case is if you did them like so:

01%20PM

It would require you to write a plugin, and I imagine there would be cases where it would fight with other plugins, but that is probably the best you could get unless something was integrated directly into the Sublime API to allow you to do such things,

1 Like

#3

It would be nice if HASHED SYNTAX HIGHLIGHTING could also be used for background colors, which would effectively provide a solution for what @rogeriodec is asking:

https://www.sublimetext.com/docs/3/color_schemes.html#hashed_syntax_highlighting

2 Likes