Map additional text colors from Zed1 themes (#3796)

This PR maps additional text colors from the Zed1 themes to the Zed2
themes.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2023-12-22 18:45:58 -05:00 committed by GitHub
parent b501f4eafc
commit 1ebfafc03d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 166 additions and 60 deletions

View file

@ -87,63 +87,52 @@ impl Zed1ThemeConverter {
Some(zed1_color_to_hsla(color))
}
let picker = &self.theme.picker;
let title_bar = &self.theme.titlebar;
let status_bar = &self.theme.workspace.status_bar;
let project_panel = &self.theme.project_panel;
let tab_bar = &self.theme.workspace.tab_bar;
let active_tab = &self.theme.workspace.tab_bar.tab_style(true, true);
let inactive_tab = &self.theme.workspace.tab_bar.tab_style(true, false);
let toolbar = &self.theme.workspace.toolbar;
let editor = &self.theme.editor;
let scrollbar = &self.theme.editor.scrollbar;
let terminal = &self.theme.terminal;
let zed1_titlebar_border = convert(self.theme.titlebar.container.border.color);
let title_bar_border = convert(title_bar.container.border.color);
Ok(ThemeColorsRefinement {
border: zed1_titlebar_border,
border_variant: zed1_titlebar_border,
border: title_bar_border,
border_variant: title_bar_border,
background: convert(self.theme.workspace.background),
elevated_surface_background: self
.theme
.picker
.container
.background_color
.map(zed1_color_to_hsla),
title_bar_background: self
.theme
.titlebar
.container
.background_color
.map(zed1_color_to_hsla),
status_bar_background: self
.theme
.workspace
.status_bar
elevated_surface_background: picker.container.background_color.map(zed1_color_to_hsla),
title_bar_background: title_bar.container.background_color.map(zed1_color_to_hsla),
status_bar_background: status_bar
.container
.background_color
.map(zed1_color_to_hsla)
.or_else(|| {
self.theme
.titlebar
.container
.background_color
.map(zed1_color_to_hsla)
}),
panel_background: self
.theme
.project_panel
.or_else(|| title_bar.container.background_color.map(zed1_color_to_hsla)),
panel_background: project_panel
.container
.background_color
.map(zed1_color_to_hsla),
text: convert(self.theme.project_panel.entry.default_style().text.color),
text_muted: convert(active_tab.description.text.color),
element_hover: self
.theme
.picker
text_accent: convert(status_bar.panel_buttons.button.active_state().icon_color),
text_disabled: convert(status_bar.panel_buttons.button.disabled_style().icon_color),
text_placeholder: picker
.empty_input_editor
.placeholder_text
.as_ref()
.map(|placeholder_text| placeholder_text.color)
.map(zed1_color_to_hsla),
element_hover: picker
.item
.hovered
.as_ref()
.and_then(|hovered| hovered.container.background_color)
.map(zed1_color_to_hsla),
element_selected: self
.theme
.picker
element_selected: picker
.item
.active_state()
.container
@ -159,13 +148,13 @@ impl Zed1ThemeConverter {
.background_color
.map(zed1_color_to_hsla),
toolbar_background: toolbar.container.background_color.map(zed1_color_to_hsla),
editor_foreground: convert(self.theme.editor.text_color),
editor_background: convert(self.theme.editor.background),
editor_gutter_background: convert(self.theme.editor.gutter_background),
editor_line_number: convert(self.theme.editor.line_number),
editor_active_line_number: convert(self.theme.editor.line_number_active),
editor_wrap_guide: convert(self.theme.editor.wrap_guide),
editor_active_wrap_guide: convert(self.theme.editor.active_wrap_guide),
editor_foreground: convert(editor.text_color),
editor_background: convert(editor.background),
editor_gutter_background: convert(editor.gutter_background),
editor_line_number: convert(editor.line_number),
editor_active_line_number: convert(editor.line_number_active),
editor_wrap_guide: convert(editor.wrap_guide),
editor_active_wrap_guide: convert(editor.active_wrap_guide),
scrollbar_track_background: scrollbar.track.background_color.map(zed1_color_to_hsla),
scrollbar_track_border: convert(scrollbar.track.border.color),
scrollbar_thumb_background: scrollbar.thumb.background_color.map(zed1_color_to_hsla),
@ -174,23 +163,23 @@ impl Zed1ThemeConverter {
.thumb
.background_color
.map(zed1_color_to_hsla),
terminal_background: convert(self.theme.terminal.background),
terminal_ansi_bright_black: convert(self.theme.terminal.bright_black),
terminal_ansi_bright_red: convert(self.theme.terminal.bright_red),
terminal_ansi_bright_green: convert(self.theme.terminal.bright_green),
terminal_ansi_bright_yellow: convert(self.theme.terminal.bright_yellow),
terminal_ansi_bright_blue: convert(self.theme.terminal.bright_blue),
terminal_ansi_bright_magenta: convert(self.theme.terminal.bright_magenta),
terminal_ansi_bright_cyan: convert(self.theme.terminal.bright_cyan),
terminal_ansi_bright_white: convert(self.theme.terminal.bright_white),
terminal_ansi_black: convert(self.theme.terminal.black),
terminal_ansi_red: convert(self.theme.terminal.red),
terminal_ansi_green: convert(self.theme.terminal.green),
terminal_ansi_yellow: convert(self.theme.terminal.yellow),
terminal_ansi_blue: convert(self.theme.terminal.blue),
terminal_ansi_magenta: convert(self.theme.terminal.magenta),
terminal_ansi_cyan: convert(self.theme.terminal.cyan),
terminal_ansi_white: convert(self.theme.terminal.white),
terminal_background: convert(terminal.background),
terminal_ansi_bright_black: convert(terminal.bright_black),
terminal_ansi_bright_red: convert(terminal.bright_red),
terminal_ansi_bright_green: convert(terminal.bright_green),
terminal_ansi_bright_yellow: convert(terminal.bright_yellow),
terminal_ansi_bright_blue: convert(terminal.bright_blue),
terminal_ansi_bright_magenta: convert(terminal.bright_magenta),
terminal_ansi_bright_cyan: convert(terminal.bright_cyan),
terminal_ansi_bright_white: convert(terminal.bright_white),
terminal_ansi_black: convert(terminal.black),
terminal_ansi_red: convert(terminal.red),
terminal_ansi_green: convert(terminal.green),
terminal_ansi_yellow: convert(terminal.yellow),
terminal_ansi_blue: convert(terminal.blue),
terminal_ansi_magenta: convert(terminal.magenta),
terminal_ansi_cyan: convert(terminal.cyan),
terminal_ansi_white: convert(terminal.white),
..Default::default()
})
}