more theme change

This commit is contained in:
Dongdong Zhou 2021-09-27 18:07:52 +01:00
parent 204b99b0be
commit 14a38dc89e
6 changed files with 44 additions and 10 deletions

View File

@ -488,7 +488,6 @@ pub fn new_text_layout(
line: usize,
line_content: &str,
bounds: [f64; 2],
theme: &Arc<HashMap<String, Color>>,
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()),

View File

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

View File

@ -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(

View File

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

View File

@ -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"

View File

@ -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"