From 268be71d8e8700e3ee349387102c806b71c0a664 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 7 Nov 2023 13:15:08 +0100 Subject: [PATCH] Add colors for document highlights --- crates/editor2/src/editor.rs | 4 ++-- crates/gpui2/src/app.rs | 8 ++++---- crates/theme2/src/colors.rs | 2 ++ crates/theme2/src/default_colors.rs | 4 ++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rs index 88df58c50f704b7fd6663e9888a75312017e57e6..be8375336c604f9ca87f390128ab01c3991b37f1 100644 --- a/crates/editor2/src/editor.rs +++ b/crates/editor2/src/editor.rs @@ -4057,12 +4057,12 @@ impl Editor { this.highlight_background::( read_ranges, - |theme| todo!("theme.editor.document_highlight_read_background"), + |theme| theme.editor_document_highlight_read_background, cx, ); this.highlight_background::( write_ranges, - |theme| todo!("theme.editor.document_highlight_write_background"), + |theme| theme.editor_document_highlight_write_background, cx, ); cx.notify(); diff --git a/crates/gpui2/src/app.rs b/crates/gpui2/src/app.rs index 9afffeb685a8c38ecd8a0aaf075ce6a2c4fbdf5e..801047de5fc857fd3a1bab0a89535febc5126c25 100644 --- a/crates/gpui2/src/app.rs +++ b/crates/gpui2/src/app.rs @@ -48,15 +48,15 @@ pub struct AppCell { impl AppCell { #[track_caller] pub fn borrow(&self) -> AppRef { - let thread_id = std::thread::current().id(); - eprintln!("borrowed {thread_id:?}"); + // let thread_id = std::thread::current().id(); + // eprintln!("borrowed {thread_id:?}"); AppRef(self.app.borrow()) } #[track_caller] pub fn borrow_mut(&self) -> AppRefMut { - let thread_id = std::thread::current().id(); - eprintln!("borrowed {thread_id:?}"); + // let thread_id = std::thread::current().id(); + // eprintln!("borrowed {thread_id:?}"); AppRefMut(self.app.borrow_mut()) } } diff --git a/crates/theme2/src/colors.rs b/crates/theme2/src/colors.rs index 441f22be81593926f51d808cf1d80778854887b4..8e0e48b95c277a3e053ab937abe072a8eb6ecd2e 100644 --- a/crates/theme2/src/colors.rs +++ b/crates/theme2/src/colors.rs @@ -114,6 +114,8 @@ pub struct ThemeColors { pub editor_invisible: Hsla, pub editor_wrap_guide: Hsla, pub editor_active_wrap_guide: Hsla, + pub editor_document_highlight_read_background: Hsla, + pub editor_document_highlight_write_background: Hsla, pub terminal_background: Hsla, pub terminal_ansi_bright_black: Hsla, pub terminal_ansi_bright_red: Hsla, diff --git a/crates/theme2/src/default_colors.rs b/crates/theme2/src/default_colors.rs index ce6fe25907d547352ef4c2fe7b1635f70fdd79aa..f79518e7696894bc31f9149201446d4c64d53c08 100644 --- a/crates/theme2/src/default_colors.rs +++ b/crates/theme2/src/default_colors.rs @@ -249,6 +249,8 @@ impl ThemeColors { editor_invisible: neutral().light_alpha().step_4(), // todo!("pick the right colors") editor_wrap_guide: neutral().light_alpha().step_4(), // todo!("pick the right colors") editor_active_wrap_guide: neutral().light_alpha().step_4(), // todo!("pick the right colors") + editor_document_highlight_read_background: neutral().light_alpha().step_4(), // todo!("pick the right colors") + editor_document_highlight_write_background: neutral().light_alpha().step_4(), // todo!("pick the right colors") terminal_background: neutral().light().step_1(), terminal_ansi_black: black().light().step_12(), terminal_ansi_red: red().light().step_11(), @@ -320,6 +322,8 @@ impl ThemeColors { editor_invisible: neutral().dark_alpha().step_4(), // todo!("pick the right colors") editor_wrap_guide: neutral().dark_alpha().step_4(), // todo!("pick the right colors") editor_active_wrap_guide: neutral().dark_alpha().step_4(), // todo!("pick the right colors") + editor_document_highlight_read_background: neutral().dark_alpha().step_4(), // todo!("pick the right colors") + editor_document_highlight_write_background: neutral().dark_alpha().step_4(), // todo!("pick the right colors") terminal_background: neutral().dark().step_1(), terminal_ansi_black: black().dark().step_12(), terminal_ansi_red: red().dark().step_11(),