Add rainbow indentation guides#4056
Add rainbow indentation guides#4056SoraTenshi wants to merge 9 commits intohelix-editor:masterfrom SoraTenshi:colored-indent-guides
Conversation
|
You can cherry-pick this commit from the rainbow brackets PR that adds the ability to theme rainbows helix-editor/helix@ |
This change adds a field to the schema of themes which takes a
list of styles.
rainbow = ["red", "orange", "yellow", { modifiers = ["reversed"] }]
[palette]
red = "#ff0000"
orange = "#ffa500"
yellow = "#fff000"
Normal style rules apply for each element in `rainbows`: you can
use definitions from the palette and the full fg/bg/modifiers
notation.
Themes written with `rainbow` keys are not backwards compatible.
Parsing errors will be generated for older versions of Helix
attempting to use themes with `rainbow` keys.
A default rainbow is provided with base16 colors.
This change is made with rainbow pair characters (parens, brackets, etc.)
in mind but it could also be used for other rainbow cosmetic elements
like rainbow indent-guides.
|
@s0LA1337, if I can ask, why did you close ? |
I think I did an accident here. |
|
|
||
| for i in starting_indent..(indent_level / tab_width as u16) { | ||
| let style = if config.indent_guides.rainbow { | ||
| indent_guide_style.patch(theme.get_rainbow(i as usize)) |
There was a problem hiding this comment.
This may look odd if rainbow = true is set as well as skip-levels = n for some non-zero n. Currently if you skip one level, the first level uses the second color of the rainbow but I think we should start the rainbow on the first indent guide
There was a problem hiding this comment.
At first glance this looks like it would be weird, but this behaviour causes an interesting side-effect together with your rainbow brackets.
It matches the color based on indentation.
consider this:

if i set the linenumber skip for the indent guides now to let's say 2, it would still line up

with the fix, this alignment would be lost.
|
Since this pr is kind of broken for me (not updating...) |


This PR Closes #4010
It looks something like:
