From a69d30be6ae4f4a3a3e987393a2b96d1025b2206 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 19 Jul 2024 11:32:25 +0800 Subject: [PATCH] Add `cx.theme` auto import to support WindowContent. --- crates/ui/src/theme.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/ui/src/theme.rs b/crates/ui/src/theme.rs index 3eb5e9ed..5ea72c13 100644 --- a/crates/ui/src/theme.rs +++ b/crates/ui/src/theme.rs @@ -2,7 +2,7 @@ use std::ops::Deref; use gpui::{ hsla, point, AppContext, BoxShadow, Global, Hsla, ModelContext, Pixels, SharedString, - ViewContext, WindowAppearance, + ViewContext, WindowAppearance, WindowContext, }; pub trait ActiveTheme { @@ -27,6 +27,12 @@ impl<'a, V> ActiveTheme for ModelContext<'a, V> { } } +impl<'a> ActiveTheme for WindowContext<'a> { + fn theme(&self) -> &Theme { + self.deref().theme() + } +} + /// Make a [gpui::Hsla] color. /// /// h - 0 - 360.0