diff options
author | Blaž Hrastnik | 2021-05-07 08:38:25 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-05-07 08:42:09 +0000 |
commit | f0712479cbdff239347049461be1901e13950044 (patch) | |
tree | b1837b7336a45c21c1baccfd8cca9aac76d2b3c5 /helix-term/src | |
parent | f87dee926a08162f937cb08454c452c7c4dfdb77 (diff) |
Define text color (mostly) in theme.toml.
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/ui/editor.rs | 11 | ||||
-rw-r--r-- | helix-term/src/ui/markdown.rs | 2 | ||||
-rw-r--r-- | helix-term/src/ui/menu.rs | 2 | ||||
-rw-r--r-- | helix-term/src/ui/mod.rs | 6 | ||||
-rw-r--r-- | helix-term/src/ui/picker.rs | 2 | ||||
-rw-r--r-- | helix-term/src/ui/prompt.rs | 3 | ||||
-rw-r--r-- | helix-term/src/ui/text.rs | 2 |
7 files changed, 10 insertions, 18 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 79a6ede2..58378eaf 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -3,7 +3,7 @@ use crate::{ compositor::{Component, Compositor, Context, EventResult}, key, keymap::{self, Keymaps}, - ui::{text_color, Completion}, + ui::Completion, }; use helix_core::{ @@ -150,7 +150,7 @@ impl EditorView { // first rule that matches (rule.all(|scope| scopes.contains(scope))) let style = match spans.first() { Some(span) => theme.get(theme.scopes()[span.0].as_str()), - None => Style::default().fg(Color::Rgb(164, 160, 232)), // lavender + None => theme.get("ui.text"), }; // TODO: we could render the text to a surface, then cache that, that @@ -409,11 +409,10 @@ impl EditorView { Mode::Select => "SEL", Mode::Normal => "NOR", }; - // TODO: share text_color styles inside theme let text_color = if is_focused { - Style::default().fg(Color::Rgb(219, 191, 239)) // lilac + theme.get("ui.text.focus") } else { - Style::default().fg(Color::Rgb(164, 160, 232)) // lavender + theme.get("ui.text") }; // statusline surface.set_style( @@ -632,7 +631,7 @@ impl Component for EditorView { let style = if *severity == Severity::Error { cx.editor.theme.get("error") } else { - Style::default().fg(Color::Rgb(164, 160, 232)) // lavender + cx.editor.theme.get("ui.text") }; surface.set_string( diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs index 0b41e044..8d14841e 100644 --- a/helix-term/src/ui/markdown.rs +++ b/helix-term/src/ui/markdown.rs @@ -104,7 +104,7 @@ fn parse<'a>(contents: &'a str, theme: Option<&Theme>) -> tui::text::Text<'a> { Some(span) => { theme.get(theme.scopes()[span.0].as_str()) } - None => Style::default().fg(Color::Rgb(164, 160, 232)), // lavender + None => text_style, }; let mut slice = &text[start..end]; diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index f8f6f269..d055d0d0 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -240,7 +240,7 @@ impl<T: 'static> Component for Menu<T> { } fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) { - let style = Style::default().fg(Color::Rgb(164, 160, 232)); // lavender + let style = cx.editor.theme.get("ui.text"); let selected = Style::default().fg(Color::Rgb(255, 255, 255)); let scroll = self.scroll; diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index a16b7ef0..dc1ec6b6 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -24,12 +24,6 @@ use helix_view::{Document, Editor, View}; use std::path::{Path, PathBuf}; -// TODO: temp -#[inline(always)] -pub fn text_color() -> Style { - Style::default().fg(Color::Rgb(219, 191, 239)) // lilac -} - pub fn regex_prompt( cx: &mut crate::commands::Context, prompt: String, diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 39580f66..73cbf07f 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -245,7 +245,7 @@ impl<T: 'static> Component for Picker<T> { // -- Render the contents: - let style = Style::default().fg(Color::Rgb(164, 160, 232)); // lavender + let style = cx.editor.theme.get("ui.text"); let selected = Style::default().fg(Color::Rgb(255, 255, 255)); let rows = inner.height - 2; // -1 for search bar diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index f199115f..b7cf4d94 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -103,11 +103,10 @@ use tui::{ }; const BASE_WIDTH: u16 = 30; -use crate::ui::text_color; impl Prompt { pub fn render_prompt(&self, area: Rect, surface: &mut Surface, theme: &Theme) { - let text_color = text_color(); + let text_color = theme.get("ui.text.focus"); // completion if !self.completion.is_empty() { // TODO: find out better way of clearing individual lines of the screen diff --git a/helix-term/src/ui/text.rs b/helix-term/src/ui/text.rs index 588e12c4..6225e769 100644 --- a/helix-term/src/ui/text.rs +++ b/helix-term/src/ui/text.rs @@ -25,7 +25,7 @@ impl Component for Text { use tui::widgets::{Paragraph, Widget, Wrap}; let contents = tui::text::Text::from(self.contents.clone()); - let style = Style::default().fg(Color::Rgb(164, 160, 232)); // lavender + let style = cx.editor.theme.get("ui.text"); let par = Paragraph::new(contents).wrap(Wrap { trim: false }); // .scroll(x, y) offsets |