Skip to content

Add rainbow indentation guides#4056

Closed
SoraTenshi wants to merge 9 commits intohelix-editor:masterfrom
SoraTenshi:colored-indent-guides
Closed

Add rainbow indentation guides#4056
SoraTenshi wants to merge 9 commits intohelix-editor:masterfrom
SoraTenshi:colored-indent-guides

Conversation

@SoraTenshi
Copy link
Copy Markdown
Contributor

This PR Closes #4010

It looks something like:
image

@SoraTenshi SoraTenshi marked this pull request as ready for review October 1, 2022 00:46
@the-mikedavis
Copy link
Copy Markdown
Member

You can cherry-pick this commit from the rainbow brackets PR that adds the ability to theme rainbows helix-editor/helix@c18ff11 (#2857)

the-mikedavis and others added 2 commits October 1, 2022 19:34
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.
@kirawi kirawi added A-theme Area: Theme and appearence related A-gui Area: Helix gui improvements S-waiting-on-review Status: Awaiting review from a maintainer. labels Oct 1, 2022
Comment thread helix-term/src/ui/editor.rs Outdated
Comment thread helix-term/src/ui/editor.rs Outdated
Comment thread helix-term/src/ui/editor.rs Outdated
Comment thread helix-term/src/ui/editor.rs Outdated
@SoraTenshi SoraTenshi closed this by deleting the head repository Oct 12, 2022
@poliorcetics
Copy link
Copy Markdown
Contributor

@s0LA1337, if I can ask, why did you close ?

@SoraTenshi
Copy link
Copy Markdown
Contributor Author

@s0LA1337, if I can ask, why did you close ?

I think I did an accident here.
I had somehow a corruption of my fork, and had to close the repo.
Thanks for reminding me, will reopen it.

@SoraTenshi SoraTenshi reopened this Oct 12, 2022

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))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
image

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

with the fix, this alignment would be lost.

@SoraTenshi
Copy link
Copy Markdown
Contributor Author

SoraTenshi commented Oct 23, 2022

EDIT: Somehow github doesn't synchronize the Pullrequest with my branch, does anyone know how i would be able to solve it?

Since i've gotten a bit of feedback from some people saying, that it may be too bright, i added a dimming feature.

With dim:
image

Without dim:
image

@SoraTenshi
Copy link
Copy Markdown
Contributor Author

Since this pr is kind of broken for me (not updating...)
Please check out this (new) PR: #4493

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-gui Area: Helix gui improvements A-theme Area: Theme and appearence related S-waiting-on-review Status: Awaiting review from a maintainer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

colored indent guides

4 participants