From cb0880cf3c4528202881a0333c74d052bcd5cf05 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 6 Dec 2023 10:08:26 -0500 Subject: [PATCH] Add debugging colors to styled_ext --- crates/ui2/src/styled_ext.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/crates/ui2/src/styled_ext.rs b/crates/ui2/src/styled_ext.rs index e567830d6ca9ddbc978d0bd08b43ab404625ae9b..63711cbaf9aa5b1ae58f4d452e9892a4306142b8 100644 --- a/crates/ui2/src/styled_ext.rs +++ b/crates/ui2/src/styled_ext.rs @@ -1,4 +1,4 @@ -use gpui::{px, Styled, WindowContext}; +use gpui::{hsla, px, Styled, WindowContext}; use settings::Settings; use theme::ThemeSettings; @@ -104,6 +104,30 @@ pub trait StyledExt: Styled + Sized { fn elevation_3(self, cx: &mut WindowContext) -> Self { elevated(self, cx, ElevationIndex::ModalSurface) } + + fn debug_bg_red(self) -> Self { + self.bg(gpui::red()) + } + + fn debug_bg_green(self) -> Self { + self.bg(gpui::green()) + } + + fn debug_bg_blue(self) -> Self { + self.bg(gpui::blue()) + } + + fn debug_bg_yellow(self) -> Self { + self.bg(hsla(60. / 360., 1., 0.5, 1.)) + } + + fn debug_bg_cyan(self) -> Self { + self.bg(hsla(160. / 360., 1., 0.5, 1.)) + } + + fn debug_bg_magenta(self) -> Self { + self.bg(hsla(300. / 360., 1., 0.5, 1.)) + } } impl StyledExt for E {}