diff --git a/core/src/buffer.rs b/core/src/buffer.rs index df4dcb43..fa036452 100644 --- a/core/src/buffer.rs +++ b/core/src/buffer.rs @@ -488,7 +488,6 @@ pub fn new_text_layout( line: usize, line_content: &str, bounds: [f64; 2], - theme: &Arc>, config: &Config, ) -> PietTextLayout { let line_content = line_content.replace('\t', " "); @@ -504,7 +503,9 @@ pub fn new_text_layout( ); for (start, end, style) in styles.iter() { if let Some(fg_color) = style.fg_color.as_ref() { - if let Some(fg_color) = theme.get(fg_color) { + if let Some(fg_color) = + config.get_color(&("style.".to_string() + fg_color)) + { layout_builder = layout_builder.range_attribute( start..end, TextAttribute::TextColor(fg_color.clone()), diff --git a/core/src/config.rs b/core/src/config.rs index 4ffb338b..d068a4cf 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -20,6 +20,7 @@ impl LapceTheme { pub const LAPCE_ACTIVE_TAB: &'static str = "lapce.active_tab"; pub const LAPCE_INACTIVE_TAB: &'static str = "lapce.inactive_tab"; pub const LAPCE_DROPDOWN_SHADOW: &'static str = "lapce.dropdown_shadow"; + pub const LAPCE_BORDER: &'static str = "lapce.border"; pub const EDITOR_BACKGROUND: &'static str = "editor.background"; pub const EDITOR_FOREGROUND: &'static str = "editor.foreground"; diff --git a/core/src/editor.rs b/core/src/editor.rs index 0dd1aef4..df3b4ce3 100644 --- a/core/src/editor.rs +++ b/core/src/editor.rs @@ -1763,7 +1763,6 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceEditorViewData, env: &Env) { line, line_content, [rect.x0, rect.x1], - &data.theme, &data.config, ); ctx.draw_text( diff --git a/core/src/split.rs b/core/src/split.rs index c676d8ce..d6537fa7 100644 --- a/core/src/split.rs +++ b/core/src/split.rs @@ -1,5 +1,6 @@ use crate::{ command::{LapceUICommand, LAPCE_UI_COMMAND}, + config::{Config, LapceTheme}, data::{EditorType, LapceEditorData, LapceEditorLens, LapceTabData}, editor::{EditorLocation, LapceEditorView}, scroll::LapceScroll, @@ -123,7 +124,7 @@ pub fn even_flex_children(&mut self) { } } - fn paint_bar(&mut self, ctx: &mut PaintCtx, env: &Env) { + fn paint_bar(&mut self, ctx: &mut PaintCtx, config: &Config) { let children_len = self.children.len(); if children_len <= 1 { return; @@ -140,8 +141,11 @@ fn paint_bar(&mut self, ctx: &mut PaintCtx, env: &Env) { let line = Line::new(Point::new(0.0, y), Point::new(size.width, y)); line }; - let color = env.get(theme::BORDER_LIGHT); - ctx.stroke(line, &color, 1.0); + ctx.stroke( + line, + config.get_color_unchecked(LapceTheme::LAPCE_BORDER), + 1.0, + ); } } @@ -460,7 +464,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) { child.widget.paint(ctx, data, env); } if self.show_border { - self.paint_bar(ctx, env); + self.paint_bar(ctx, &data.config); } } } diff --git a/defaults/dark-theme.toml b/defaults/dark-theme.toml index e931ba86..27893f50 100644 --- a/defaults/dark-theme.toml +++ b/defaults/dark-theme.toml @@ -1,23 +1,26 @@ white = "#ABB2BF" black = "#282C34" grey = "#3E4451" -light_grey = "#f2f2f2" +light_grey = "#2c313c" blue = "#61AFEF" red = "#E06C75" -yellow = "#D19A66" +yellow = "#e5c07b" +orange = "#D19A66" green = "#98C379" purple = "#C678DD" +cyan = "#56b6c2" "lapce.active_tab" = "$white" "lapce.inactive_tab" = "$grey" "lapce.error" = "$red" "lapce.warn" = "$yellow" "lapce.dropdown_shadow" = "#000000" +"lapce.border" = "#000000" "editor.background" = "$black" "editor.foreground" = "$white" "editor.dim" = "#A0A1A7" -"editor.caret" = "$blue" +"editor.caret" = "#528bff" "editor.selection" = "$grey" "editor.current_line" = "$light_grey" @@ -31,3 +34,27 @@ purple = "#C678DD" "panel.current" = "#dbdbdc" "status.background" = "#21252B" + +"style.constant" = "$yellow" +"style.type" = "$yellow" +"style.number" = "$yellow" +"style.enum" = "$yellow" +"style.struct" = "$yellow" +"style.structure" = "$yellow" +"style.interface" = "$yellow" + +"style.function" = "$blue" +"style.method" = "$blue" +"style.function.method" = "$blue" + +"style.keyword" = "$purple" +"style.selfKeyword" = "$purple" + +"style.field" = "$red" +"style.property" = "$red" +"style.enumMember" = "$red" +"style.enum-member" = "$red" + +"style.string" = "$green" + +"style.type.builtin" = "$cyan" diff --git a/defaults/light-theme.toml b/defaults/light-theme.toml index b606e6fe..26e8c84a 100644 --- a/defaults/light-theme.toml +++ b/defaults/light-theme.toml @@ -7,12 +7,14 @@ red = "#e51400" yellow = "#e9a700" green = "#50A14F" purple = "#A626A4" +cyan = "#0184bc" "lapce.active_tab" = "$white" "lapce.inactive_tab" = "$grey" "lapce.error" = "$red" "lapce.warn" = "$yellow" "lapce.dropdown_shadow" = "#b4b4b4" +"lapce.border" = "#eaeaeb" "editor.background" = "$white" "editor.foreground" = "$black"