Add debugging colors to styled_ext

Nate Butler created

Change summary

crates/ui2/src/styled_ext.rs | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

Detailed changes

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<E: Styled> StyledExt for E {}