mirror of https://github.com/lapce/lapce.git
feat: more theme keys (#1726)
This commit is contained in:
parent
6492ec2cb5
commit
72f8057465
|
@ -121,10 +121,10 @@ yellow = "#E5C07B"
|
|||
"source_control.removed" = "#FF526632"
|
||||
"source_control.modified" = "#0184BC32"
|
||||
|
||||
"palette.current.background" = "#2C313A"
|
||||
"palette.current.foreground" = "$white"
|
||||
"palette.background" = "#21252B"
|
||||
"palette.foreground" = "$white"
|
||||
"palette.current.background" = "#2C313A"
|
||||
"palette.current.foreground" = "$white"
|
||||
|
||||
"completion.background" = "#21252B"
|
||||
"completion.current" = "#2C313A"
|
||||
|
@ -135,8 +135,14 @@ yellow = "#E5C07B"
|
|||
"activity.current" = "$black"
|
||||
|
||||
"panel.background" = "#21252B"
|
||||
"panel.current" = "#2C313A"
|
||||
"panel.hovered" = "#343A45"
|
||||
"panel.foreground" = "$white"
|
||||
"panel.foreground.dim" = "#5C6370"
|
||||
"panel.current.background" = "#2C313A"
|
||||
"panel.current.foreground" = "$white"
|
||||
"panel.current.foreground.dim" = "#5C6370"
|
||||
"panel.hovered.background" = "#343A45"
|
||||
"panel.hovered.foreground" = "$white"
|
||||
"panel.hovered.foreground.dim" = "#5C6370"
|
||||
|
||||
"status.background" = "#21252B"
|
||||
"status.foreground" = "$white"
|
||||
|
|
|
@ -147,10 +147,10 @@ yellow = "#C18401"
|
|||
"source_control.removed" = "#FF526632"
|
||||
"source_control.modified" = "#0184BC32"
|
||||
|
||||
"palette.current.background" = "#DBDBDC"
|
||||
"palette.current.foreground" = "$black"
|
||||
"palette.background" = "#EAEAEB"
|
||||
"palette.foreground" = "$black"
|
||||
"palette.current.background" = "#DBDBDC"
|
||||
"palette.current.foreground" = "$black"
|
||||
|
||||
"completion.background" = "#EAEAEB"
|
||||
"completion.current" = "#DBDBDC"
|
||||
|
@ -161,8 +161,14 @@ yellow = "#C18401"
|
|||
"activity.current" = "$white"
|
||||
|
||||
"panel.background" = "#EAEAEB"
|
||||
"panel.current" = "#DBDBDC"
|
||||
"panel.hovered" = "#E4E4E6"
|
||||
"panel.foreground" = "$black"
|
||||
"panel.foreground.dim" = "#A0A1A7"
|
||||
"panel.current.background" = "#DBDBDC"
|
||||
"panel.current.foreground" = "$black"
|
||||
"panel.current.foreground.dim" = "#A0A1A7"
|
||||
"panel.hovered.background" = "#E4E4E6"
|
||||
"panel.hovered.foreground" = "$black"
|
||||
"panel.hovered.foreground.dim" = "#A0A1A7"
|
||||
|
||||
"status.background" = "#EAEAEB"
|
||||
"status.foreground" = "$black"
|
||||
|
|
|
@ -166,10 +166,10 @@ magenta = "#C678DD"
|
|||
"source_control.removed" = "#FF526632"
|
||||
"source_control.modified" = "#0184BC32"
|
||||
|
||||
"palette.current.background" = "#2C313A"
|
||||
"palette.current.foreground" = "$white"
|
||||
"palette.background" = "#21252B"
|
||||
"palette.foreground" = "$white"
|
||||
"palette.current.background" = "#2C313A"
|
||||
"palette.current.foreground" = "$white"
|
||||
|
||||
"completion.background" = "#21252B"
|
||||
"completion.current" = "#2C313A"
|
||||
|
@ -180,8 +180,14 @@ magenta = "#C678DD"
|
|||
"activity.current" = "$black"
|
||||
|
||||
"panel.background" = "#21252B"
|
||||
"panel.current" = "#2C313A"
|
||||
"panel.hovered" = "#343A45"
|
||||
"panel.foreground" = "$white"
|
||||
"panel.foreground.dim" = "#5C6370"
|
||||
"panel.current.background" = "#2C313A"
|
||||
"panel.current.foreground" = "$white"
|
||||
"panel.current.foreground.dim" = "#5C6370"
|
||||
"panel.hovered.background" = "#343A45"
|
||||
"panel.hovered.foreground" = "$white"
|
||||
"panel.hovered.foreground.dim" = "#5C6370"
|
||||
|
||||
"status.background" = "#21252B"
|
||||
"status.foreground" = "$white"
|
||||
|
|
|
@ -121,10 +121,10 @@ impl LapceTheme {
|
|||
pub const TERMINAL_BRIGHT_CYAN: &str = "terminal.bright_cyan";
|
||||
pub const TERMINAL_BRIGHT_MAGENTA: &str = "terminal.bright_magenta";
|
||||
|
||||
pub const PALETTE_CURRENT_BACKGROUND: &str = "palette.current.background";
|
||||
pub const PALETTE_CURRENT_FOREGROUND: &str = "palette.current.foreground";
|
||||
pub const PALETTE_BACKGROUND: &str = "palette.background";
|
||||
pub const PALETTE_FOREGROUND: &str = "palette.foreground";
|
||||
pub const PALETTE_CURRENT_BACKGROUND: &str = "palette.current.background";
|
||||
pub const PALETTE_CURRENT_FOREGROUND: &str = "palette.current.foreground";
|
||||
|
||||
pub const COMPLETION_BACKGROUND: &str = "completion.background";
|
||||
pub const COMPLETION_CURRENT: &str = "completion.current";
|
||||
|
@ -135,8 +135,14 @@ impl LapceTheme {
|
|||
pub const ACTIVITY_CURRENT: &str = "activity.current";
|
||||
|
||||
pub const PANEL_BACKGROUND: &str = "panel.background";
|
||||
pub const PANEL_CURRENT: &str = "panel.current";
|
||||
pub const PANEL_HOVERED: &str = "panel.hovered";
|
||||
pub const PANEL_FOREGROUND: &str = "panel.foreground";
|
||||
pub const PANEL_FOREGROUND_DIM: &str = "panel.foreground.dim";
|
||||
pub const PANEL_CURRENT_BACKGROUND: &str = "panel.current.background";
|
||||
pub const PANEL_CURRENT_FOREGROUND: &str = "panel.current.foreground";
|
||||
pub const PANEL_CURRENT_FOREGROUND_DIM: &str = "panel.current.foreground.dim";
|
||||
pub const PANEL_HOVERED_BACKGROUND: &str = "panel.hovered.background";
|
||||
pub const PANEL_HOVERED_FOREGROUND: &str = "panel.hovered.foreground";
|
||||
pub const PANEL_HOVERED_FOREGROUND_DIM: &str = "panel.hovered.foreground.dim";
|
||||
|
||||
pub const STATUS_BACKGROUND: &str = "status.background";
|
||||
pub const STATUS_FOREGROUND: &str = "status.foreground";
|
||||
|
|
|
@ -43,9 +43,9 @@ fn paint_single_file_node_item(
|
|||
toggle_rects: &mut HashMap<usize, Rect>,
|
||||
) {
|
||||
let background = if Some(item.path_buf.as_ref()) == active {
|
||||
Some(LapceTheme::PANEL_CURRENT)
|
||||
Some(LapceTheme::PANEL_CURRENT_BACKGROUND)
|
||||
} else if Some(current) == hovered {
|
||||
Some(LapceTheme::PANEL_HOVERED)
|
||||
Some(LapceTheme::PANEL_HOVERED_BACKGROUND)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -127,7 +127,7 @@ fn paint_single_file_node_item(
|
|||
.font(config.ui.font_family(), font_size)
|
||||
.text_color(
|
||||
config
|
||||
.get_color_unchecked(LapceTheme::EDITOR_FOREGROUND)
|
||||
.get_color_unchecked(LapceTheme::PANEL_FOREGROUND)
|
||||
.clone(),
|
||||
)
|
||||
.build()
|
||||
|
@ -319,7 +319,7 @@ pub fn new(data: &mut LapceTabData) -> Self {
|
|||
.hide_header()
|
||||
.hide_gutter()
|
||||
.hide_border()
|
||||
.set_background_color(LapceTheme::PANEL_HOVERED);
|
||||
.set_background_color(LapceTheme::PANEL_HOVERED_BACKGROUND);
|
||||
let view_id = editor.view_id;
|
||||
data.main_split.editors.insert(view_id, Arc::new(editor));
|
||||
// Create the file listing
|
||||
|
@ -1204,21 +1204,23 @@ fn paint_editor(
|
|||
|
||||
let font_size = data.config.ui.font_size() as f64;
|
||||
|
||||
if active {
|
||||
ctx.fill(
|
||||
Size::new(size.width, self.line_height)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(0.0, i as f64 * self.line_height)),
|
||||
data.config.get_color_unchecked(LapceTheme::PANEL_CURRENT),
|
||||
);
|
||||
} else if ctx.is_hot()
|
||||
let current_item = Size::new(size.width, self.line_height)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(0.0, i as f64 * self.line_height));
|
||||
|
||||
if ctx.is_hot()
|
||||
&& i == (self.mouse_pos.y / self.line_height).floor() as usize
|
||||
{
|
||||
ctx.fill(
|
||||
Size::new(size.width, self.line_height)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(0.0, i as f64 * self.line_height)),
|
||||
data.config.get_color_unchecked(LapceTheme::PANEL_HOVERED),
|
||||
current_item,
|
||||
data.config
|
||||
.get_color_unchecked(LapceTheme::PANEL_HOVERED_BACKGROUND),
|
||||
);
|
||||
} else if active {
|
||||
ctx.fill(
|
||||
current_item,
|
||||
data.config
|
||||
.get_color_unchecked(LapceTheme::PANEL_CURRENT_BACKGROUND),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1235,13 +1237,14 @@ fn paint_editor(
|
|||
self.in_view_tab_children
|
||||
.insert(i, (close_rect.inflate(2.0, 2.0), child.widget_id()));
|
||||
|
||||
let close_svg = if ctx.is_hot()
|
||||
&& close_rect.inflate(2.0, 2.0).contains(self.mouse_pos)
|
||||
{
|
||||
ctx.fill(
|
||||
close_rect.inflate(2.0, 2.0),
|
||||
data.config.get_color_unchecked(LapceTheme::PANEL_CURRENT),
|
||||
);
|
||||
let close_svg = if ctx.is_hot() && current_item.contains(self.mouse_pos) {
|
||||
if close_rect.inflate(2.0, 2.0).contains(self.mouse_pos) {
|
||||
ctx.fill(
|
||||
close_rect.inflate(2.0, 2.0),
|
||||
data.config
|
||||
.get_color_unchecked(LapceTheme::PANEL_CURRENT_BACKGROUND),
|
||||
);
|
||||
}
|
||||
Some(data.config.ui_svg(LapceIcons::CLOSE))
|
||||
} else if pristine {
|
||||
None
|
||||
|
@ -1279,7 +1282,7 @@ fn paint_editor(
|
|||
.font(data.config.ui.font_family(), font_size)
|
||||
.text_color(
|
||||
data.config
|
||||
.get_color_unchecked(LapceTheme::EDITOR_FOREGROUND)
|
||||
.get_color_unchecked(LapceTheme::PANEL_FOREGROUND)
|
||||
.clone(),
|
||||
);
|
||||
if !hint.is_empty() {
|
||||
|
@ -1287,7 +1290,7 @@ fn paint_editor(
|
|||
total_len - hint.len()..total_len,
|
||||
TextAttribute::TextColor(
|
||||
data.config
|
||||
.get_color_unchecked(LapceTheme::EDITOR_DIM)
|
||||
.get_color_unchecked(LapceTheme::PANEL_FOREGROUND_DIM)
|
||||
.clone(),
|
||||
),
|
||||
);
|
||||
|
@ -1453,7 +1456,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
|
|||
)
|
||||
.text_color(
|
||||
data.config
|
||||
.get_color_unchecked(LapceTheme::EDITOR_FOREGROUND)
|
||||
.get_color_unchecked(LapceTheme::PANEL_FOREGROUND)
|
||||
.clone(),
|
||||
)
|
||||
.build()
|
||||
|
|
|
@ -557,9 +557,9 @@ pub fn paint_file_node_item_by_index(
|
|||
}
|
||||
if current >= min {
|
||||
let background = if current == active {
|
||||
Some(LapceTheme::PANEL_CURRENT)
|
||||
Some(LapceTheme::PANEL_CURRENT_BACKGROUND)
|
||||
} else if Some(current) == hovered {
|
||||
Some(LapceTheme::PANEL_HOVERED)
|
||||
Some(LapceTheme::PANEL_HOVERED_BACKGROUND)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
|
|
@ -345,7 +345,8 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
|
|||
));
|
||||
ctx.fill(
|
||||
rect,
|
||||
data.config.get_color_unchecked(LapceTheme::PANEL_CURRENT),
|
||||
data.config
|
||||
.get_color_unchecked(LapceTheme::PANEL_CURRENT_BACKGROUND),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -367,7 +368,9 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
|
|||
if current_line.contains(mouse_pos) {
|
||||
ctx.fill(
|
||||
current_line,
|
||||
data.config.get_color_unchecked(LapceTheme::PANEL_CURRENT),
|
||||
data.config.get_color_unchecked(
|
||||
LapceTheme::PANEL_CURRENT_BACKGROUND,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -398,7 +398,8 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &druid::Env)
|
|||
if problem_rect.contains(self.mouse_pos) {
|
||||
ctx.fill(
|
||||
problem_rect,
|
||||
data.config.get_color_unchecked(LapceTheme::PANEL_CURRENT),
|
||||
data.config
|
||||
.get_color_unchecked(LapceTheme::PANEL_CURRENT_BACKGROUND),
|
||||
);
|
||||
}
|
||||
if let Some((rect, svg)) = error_svg {
|
||||
|
@ -471,7 +472,8 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &druid::Env)
|
|||
if icon.rect.contains(self.mouse_pos) {
|
||||
ctx.fill(
|
||||
icon.rect,
|
||||
data.config.get_color_unchecked(LapceTheme::PANEL_CURRENT),
|
||||
data.config
|
||||
.get_color_unchecked(LapceTheme::PANEL_CURRENT_BACKGROUND),
|
||||
);
|
||||
}
|
||||
{
|
||||
|
@ -511,7 +513,8 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &druid::Env)
|
|||
if rect.contains(self.mouse_pos) {
|
||||
ctx.fill(
|
||||
rect,
|
||||
data.config.get_color_unchecked(LapceTheme::PANEL_CURRENT),
|
||||
data.config
|
||||
.get_color_unchecked(LapceTheme::PANEL_CURRENT_BACKGROUND),
|
||||
);
|
||||
}
|
||||
if let Some((rect, svg)) = svg {
|
||||
|
|
Loading…
Reference in New Issue