Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add ability to separately set background color for highlighted brackets (#17566)
thataboy11058765bec3
diff --git a/crates/editor/src/highlight_matching_bracket.rs b/crates/editor/src/highlight_matching_bracket.rsindex 67915d4d7b4..f63b363f34f 100644--- a/crates/editor/src/highlight_matching_bracket.rs+++ b/crates/editor/src/highlight_matching_bracket.rs@@ -32,7 +32,7 @@ pub fn refresh_matching_bracket_highlights(editor: &mut Editor, cx: &mut ViewConopening_range.to_anchors(&snapshot.buffer_snapshot),closing_range.to_anchors(&snapshot.buffer_snapshot),],- |theme| theme.editor_document_highlight_read_background,+ |theme| theme.editor_document_highlight_bracket_background,cx,)}diff --git a/crates/theme/src/default_colors.rs b/crates/theme/src/default_colors.rsindex 4def0bb8d74..a7521bd374d 100644--- a/crates/theme/src/default_colors.rs+++ b/crates/theme/src/default_colors.rs@@ -80,6 +80,7 @@ impl ThemeColors {editor_indent_guide_active: neutral().light_alpha().step_6(),editor_document_highlight_read_background: neutral().light_alpha().step_3(),editor_document_highlight_write_background: neutral().light_alpha().step_4(),+ editor_document_highlight_bracket_background: green().light_alpha().step_5(),terminal_background: neutral().light().step_1(),terminal_foreground: black().light().step_12(),terminal_bright_foreground: black().light().step_11(),@@ -179,6 +180,7 @@ impl ThemeColors {editor_indent_guide_active: neutral().dark_alpha().step_6(),editor_document_highlight_read_background: neutral().dark_alpha().step_4(),editor_document_highlight_write_background: neutral().dark_alpha().step_4(),+ editor_document_highlight_bracket_background: green().dark_alpha().step_6(),terminal_background: neutral().dark().step_1(),terminal_ansi_background: neutral().dark().step_1(),terminal_foreground: white().dark().step_12(),diff --git a/crates/theme/src/one_themes.rs b/crates/theme/src/one_themes.rsindex 69e69ce23dc..50a4184e8bc 100644--- a/crates/theme/src/one_themes.rs+++ b/crates/theme/src/one_themes.rs@@ -102,6 +102,7 @@ pub(crate) fn one_dark() -> Theme {0.2,),editor_document_highlight_write_background: gpui::red(),+ editor_document_highlight_bracket_background: gpui::green(),terminal_background: bg,// todo("Use one colors for terminal")diff --git a/crates/theme/src/schema.rs b/crates/theme/src/schema.rsindex 0229b1ea98d..91863061236 100644--- a/crates/theme/src/schema.rs+++ b/crates/theme/src/schema.rs@@ -413,6 +413,12 @@ pub struct ThemeColorsContent {#[serde(rename = "editor.document_highlight.write_background")]pub editor_document_highlight_write_background: Option<String>,+ /// Highlighted brackets background color.+ ///+ /// Matching brackets in the cursor scope are highlighted with this background color.+ #[serde(rename = "editor.document_highlight.bracket_background")]+ pub editor_document_highlight_bracket_background: Option<String>,+/// Terminal background color.#[serde(rename = "terminal.background")]pub terminal_background: Option<String>,@@ -540,6 +546,10 @@ impl ThemeColorsContent {.border.as_ref().and_then(|color| try_parse_color(color).ok());+ let editor_document_highlight_read_background = self+ .editor_document_highlight_read_background+ .as_ref()+ .and_then(|color| try_parse_color(color).ok());ThemeColorsRefinement {border,border_variant: self@@ -784,14 +794,17 @@ impl ThemeColorsContent {.editor_indent_guide_active.as_ref().and_then(|color| try_parse_color(color).ok()),- editor_document_highlight_read_background: self- .editor_document_highlight_read_background- .as_ref()- .and_then(|color| try_parse_color(color).ok()),+ editor_document_highlight_read_background,editor_document_highlight_write_background: self.editor_document_highlight_write_background.as_ref().and_then(|color| try_parse_color(color).ok()),+ editor_document_highlight_bracket_background: self+ .editor_document_highlight_bracket_background+ .as_ref()+ .and_then(|color| try_parse_color(color).ok())+ // Fall back to `editor.document_highlight.read_background`, for backwards compatibility.+ .or(editor_document_highlight_read_background),terminal_background: self.terminal_background.as_ref()diff --git a/crates/theme/src/styles/colors.rs b/crates/theme/src/styles/colors.rsindex 0b37be09923..225275f37b6 100644--- a/crates/theme/src/styles/colors.rs+++ b/crates/theme/src/styles/colors.rs@@ -171,6 +171,10 @@ pub struct ThemeColors {/// special attention. Usually a document highlight is visualized by changing/// the background color of its range.pub editor_document_highlight_write_background: Hsla,+ /// Highlighted brackets background color.+ ///+ /// Matching brackets in the cursor scope are highlighted with this background color.+ pub editor_document_highlight_bracket_background: Hsla,// ===// Terminal