mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-09-11 16:07:00 +03:00
Define text color (mostly) in theme.toml.
This commit is contained in:
parent
f87dee926a
commit
f0712479cb
@ -3,7 +3,7 @@
|
||||
compositor::{Component, Compositor, Context, EventResult},
|
||||
key,
|
||||
keymap::{self, Keymaps},
|
||||
ui::{text_color, Completion},
|
||||
ui::Completion,
|
||||
};
|
||||
|
||||
use helix_core::{
|
||||
@ -150,7 +150,7 @@ pub fn render_buffer(
|
||||
// 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 @@ pub fn render_statusline(
|
||||
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 @@ fn render(&self, mut area: Rect, surface: &mut Surface, cx: &mut Context) {
|
||||
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(
|
||||
|
@ -104,7 +104,7 @@ fn to_span(text: pulldown_cmark::CowStr) -> Span {
|
||||
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];
|
||||
|
@ -240,7 +240,7 @@ fn required_size(&mut self, viewport: (u16, u16)) -> Option<(u16, u16)> {
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -24,12 +24,6 @@
|
||||
|
||||
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,
|
||||
|
@ -245,7 +245,7 @@ fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) {
|
||||
|
||||
// -- 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
|
||||
|
@ -103,11 +103,10 @@ pub fn exit_selection(&mut self) {
|
||||
};
|
||||
|
||||
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
|
||||
|
@ -25,7 +25,7 @@ fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) {
|
||||
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
|
||||
|
@ -43,6 +43,9 @@
|
||||
"ui.popup" = { bg = "#281733" } # revolver
|
||||
"ui.window" = { bg = "#452859" } # bossa nova
|
||||
|
||||
"ui.text" = { fg = "#a4a0e8"} # lavender
|
||||
"ui.text.focus" = { fg = "#dbbfef"} # lilac
|
||||
|
||||
"warning" = "#ffcd1c"
|
||||
"error" = "#f47868"
|
||||
"info" = "#6F44F0"
|
||||
|
Loading…
Reference in New Issue
Block a user