oderwat / vscode-indent-rainbow

Extension which shows indentation with a faint rainbow colored background to make them more readable
MIT License
417 stars 57 forks source link

match colors to the colors of the brackets #116

Closed capaj closed 2 years ago

capaj commented 3 years ago

since vscode now has colorisation of brackets: https://code.visualstudio.com/blogs/2021/09/29/bracket-pair-colorization

it would be very nice if the colors could match the brackets default set

oderwat commented 3 years ago

Interesting, but I actually would not change to those colors "by default". There are more than two million installs. Most of them are working with the current default values. Changing them may end up in a UX disaster.

But we could add a set of different colors to copy & paste into the documentation, so people can pick that easily if they want that schema.

kconedera commented 2 years ago

I decided to set up my colors to match my theme's bracket colors (I use Dracula).

It took a bit of extra work, but I basically went into the .yml source code of my theme and found the "editorBracketHighlight.foreground[1-6]" key/value pairs, e.g.:

editorBracketHighlight.foreground1: *FG
editorBracketHighlight.foreground2: *PINK
editorBracketHighlight.foreground3: *CYAN

in which the *[COLOR] values are defined in an earlier code chunk, e.g.:

- &FG '#F8F8F2'
- &PINK '#FF79C6'
- &CYAN '#8BE9FD'

Then I just used a website to convert the color hex values to rbg values, added my preferred "a" value (i.e., opacity of the color), and added those values in the same order to my settings.json files using the "indentRainbow.colors" key. Here's a copy of my .json data setting my indent colors as lines following the same colors as the Dracula theme, also making them brighter/more visible than the default (the "0.7" value in the rgba):

"indentRainbow.indicatorStyle": "light",
"indentRainbow.colors": [
  "rgba(248,248,242,0.7)",
  "rgba(255,121,198,0.7)",
  "rgba(139,233,253,0.7)",
  "rgba(80,250,123,0.7)",
  "rgba(189,147,249,0.7)",
  "rgba(255,184,108,0.7)"
],

The final product: image

It would probably be relatively easy to operationalize this, or at the very least generate some copy/paste .json code for the built-in themes. If I have time I'll check it out.

Hope this helps somebody out there :)

bbeckford commented 2 years ago

Yeah I'd love this functionality, looks super neat!

oderwat commented 2 years ago

Well, this plugin was mostly created with languages that do not use curly braces but indentation in mind. Such as Python, YAML, Nim, Haskell, Makefiles, Markdown, Elixir, and so on.

The colors are meant to visualize the indentation depth (they may even have a shade related to the depth).

When the colors match those of the brackets they are just "some other colors" that are fitting the scheme. That they look "like their corresponding brackets" is only a coincidence.

If one would actually match them (level-wise) it would hardly make any sense. If you see the example from the VSCode documentation you see that the indentation level would use the same color (blue) for the second and third level and there is "no color" for the fourth level at all. So it will match sometimes but will not make much sense at other times.

But of course, everybody can use whatever colors he wants to use :)