Add get_rainbow method, added a todo for rainbow

pull/6/head
s0LA1337 2 years ago
parent 16312e3b15
commit b02d6d98ce

@ -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
};

@ -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,
}

@ -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<Style> {
vec![
Style::default().fg(Color::Red),

Loading…
Cancel
Save