diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 1431bef2..02b240a9 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -442,8 +442,7 @@ impl EditorView { for i in starting_indent..(indent_level / tab_width as u16) { let style = if config.indent_guides.rainbow { - let color_index = i as usize % theme.rainbow_length(); - indent_guide_style.patch(theme.get(&format!("rainbow.{}", color_index))) + indent_guide_style.patch(theme.get_rainbow(i as usize)) } else { indent_guide_style }; diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 5acbc5b7..2f4909f6 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -533,6 +533,8 @@ impl Default for WhitespaceCharacters { pub struct IndentGuidesConfig { pub render: bool, pub character: char, + + // TODO: Make enum to also support background rainbow for indent guides pub rainbow: bool, } diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs index 8472ec64..87ad1e69 100644 --- a/helix-view/src/theme.rs +++ b/helix-view/src/theme.rs @@ -213,6 +213,10 @@ impl Theme { self.rainbow_length } + pub fn get_rainbow(&self, index: usize) -> Style { + self.highlights[index % self.rainbow_length] + } + pub fn default_rainbow() -> Vec