WIP

Nathan Sobo created

Change summary

crates/gpui/playground/src/playground.rs       | 16 ++++++
crates/gpui/playground/ui/src/frame.rs         |  9 ++++
crates/gpui/playground/ui/src/playground_ui.rs |  6 +
crates/gpui/playground/ui/src/themes.rs        | 42 +++++++++++++------
crates/gpui/src/platform.rs                    |  2 
5 files changed, 56 insertions(+), 19 deletions(-)

Detailed changes

crates/gpui/playground/src/playground.rs 🔗

@@ -1,6 +1,9 @@
 use std::ops::{Deref, DerefMut};
 
-use gpui::{AnyElement, Element, Entity, View};
+use gpui::{
+    platform::{TitlebarOptions, WindowOptions},
+    AnyElement, Element, Entity, View,
+};
 use log::LevelFilter;
 use simplelog::SimpleLogger;
 
@@ -9,7 +12,16 @@ fn main() {
 
     gpui::App::new(()).unwrap().run(|cx| {
         cx.platform().activate(true);
-        cx.add_window(Default::default(), |_| Playground::default());
+        cx.add_window(
+            WindowOptions {
+                titlebar: Some(TitlebarOptions {
+                    appears_transparent: true,
+                    ..Default::default()
+                }),
+                ..Default::default()
+            },
+            |_| Playground::default(),
+        );
     });
 }
 

crates/gpui/playground/ui/src/frame.rs 🔗

@@ -657,6 +657,15 @@ impl Size<Rems> {
     }
 }
 
+impl From<Length> for Size<Length> {
+    fn from(value: Length) -> Self {
+        Self {
+            width: value,
+            height: value,
+        }
+    }
+}
+
 #[derive(Clone, Default, Debug)]
 pub struct Edges<T> {
     top: T,

crates/gpui/playground/ui/src/playground_ui.rs 🔗

@@ -3,7 +3,7 @@
 use frame::{length::auto, *};
 use gpui::{AnyElement, Element, LayoutContext, View, ViewContext};
 use std::{borrow::Cow, cell::RefCell, marker::PhantomData, rc::Rc};
-use themes::ThemeColors;
+use themes::{rose_pine, ThemeColors};
 use tokens::{margin::m4, text::lg};
 
 mod color;
@@ -18,12 +18,14 @@ impl<V: View> Frame<V> {}
 
 impl<V: View> Playground<V> {
     pub fn render(&mut self, _: &mut V, _: &mut gpui::ViewContext<V>) -> impl Element<V> {
-        column()
+        workspace(&rose_pine::dawn())
     }
 }
 
 fn workspace<V: View>(theme: &ThemeColors) -> impl Element<V> {
     column()
+        .size(auto())
+        .fill(theme.base(0.1))
         .child(title_bar(theme))
         .child(stage(theme))
         .child(status_bar(theme))

crates/gpui/playground/ui/src/themes.rs 🔗

@@ -24,49 +24,63 @@ pub struct ThemeColors {
 
 impl ThemeColors {
     pub fn base(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.base.lerp(level)
     }
+
     pub fn surface(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.surface.lerp(level)
     }
+
     pub fn overlay(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.overlay.lerp(level)
     }
+
     pub fn muted(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.muted.lerp(level)
     }
+
     pub fn subtle(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.subtle.lerp(level)
     }
+
     pub fn text(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.text.lerp(level)
     }
+
     pub fn highlight_low(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.highlight_low.lerp(level)
     }
+
     pub fn highlight_med(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.highlight_med.lerp(level)
     }
+
     pub fn highlight_high(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.highlight_high.lerp(level)
     }
+
     pub fn success(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.success.lerp(level)
     }
+
     pub fn warning(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.warning.lerp(level)
     }
+
     pub fn error(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.error.lerp(level)
     }
+
     pub fn inserted(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.inserted.lerp(level)
     }
+
     pub fn deleted(&self, level: f32) -> Hsla {
         self.deleted.lerp(level)
     }
+
     pub fn modified(&self, level: f32) -> Hsla {
-        self.deleted.lerp(level)
+        self.modified.lerp(level)
     }
 }
 

crates/gpui/src/platform.rs 🔗

@@ -180,7 +180,7 @@ pub struct WindowOptions<'a> {
     pub screen: Option<Rc<dyn Screen>>,
 }
 
-#[derive(Debug)]
+#[derive(Debug, Default)]
 pub struct TitlebarOptions<'a> {
     pub title: Option<&'a str>,
     pub appears_transparent: bool,