WIP
This commit is contained in:
parent
3b1e5e966a
commit
dd6425e898
5 changed files with 56 additions and 19 deletions
|
@ -1,6 +1,9 @@
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
use gpui::{AnyElement, Element, Entity, View};
|
use gpui::{
|
||||||
|
platform::{TitlebarOptions, WindowOptions},
|
||||||
|
AnyElement, Element, Entity, View,
|
||||||
|
};
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use simplelog::SimpleLogger;
|
use simplelog::SimpleLogger;
|
||||||
|
|
||||||
|
@ -9,7 +12,16 @@ fn main() {
|
||||||
|
|
||||||
gpui::App::new(()).unwrap().run(|cx| {
|
gpui::App::new(()).unwrap().run(|cx| {
|
||||||
cx.platform().activate(true);
|
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(),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)]
|
#[derive(Clone, Default, Debug)]
|
||||||
pub struct Edges<T> {
|
pub struct Edges<T> {
|
||||||
top: T,
|
top: T,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use frame::{length::auto, *};
|
use frame::{length::auto, *};
|
||||||
use gpui::{AnyElement, Element, LayoutContext, View, ViewContext};
|
use gpui::{AnyElement, Element, LayoutContext, View, ViewContext};
|
||||||
use std::{borrow::Cow, cell::RefCell, marker::PhantomData, rc::Rc};
|
use std::{borrow::Cow, cell::RefCell, marker::PhantomData, rc::Rc};
|
||||||
use themes::ThemeColors;
|
use themes::{rose_pine, ThemeColors};
|
||||||
use tokens::{margin::m4, text::lg};
|
use tokens::{margin::m4, text::lg};
|
||||||
|
|
||||||
mod color;
|
mod color;
|
||||||
|
@ -18,12 +18,14 @@ impl<V: View> Frame<V> {}
|
||||||
|
|
||||||
impl<V: View> Playground<V> {
|
impl<V: View> Playground<V> {
|
||||||
pub fn render(&mut self, _: &mut V, _: &mut gpui::ViewContext<V>) -> impl Element<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> {
|
fn workspace<V: View>(theme: &ThemeColors) -> impl Element<V> {
|
||||||
column()
|
column()
|
||||||
|
.size(auto())
|
||||||
|
.fill(theme.base(0.1))
|
||||||
.child(title_bar(theme))
|
.child(title_bar(theme))
|
||||||
.child(stage(theme))
|
.child(stage(theme))
|
||||||
.child(status_bar(theme))
|
.child(status_bar(theme))
|
||||||
|
|
|
@ -24,49 +24,63 @@ pub struct ThemeColors {
|
||||||
|
|
||||||
impl ThemeColors {
|
impl ThemeColors {
|
||||||
pub fn base(&self, level: f32) -> Hsla {
|
pub fn base(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.base.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn surface(&self, level: f32) -> Hsla {
|
pub fn surface(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.surface.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn overlay(&self, level: f32) -> Hsla {
|
pub fn overlay(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.overlay.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn muted(&self, level: f32) -> Hsla {
|
pub fn muted(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.muted.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn subtle(&self, level: f32) -> Hsla {
|
pub fn subtle(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.subtle.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn text(&self, level: f32) -> Hsla {
|
pub fn text(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.text.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn highlight_low(&self, level: f32) -> Hsla {
|
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 {
|
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 {
|
pub fn highlight_high(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.highlight_high.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn success(&self, level: f32) -> Hsla {
|
pub fn success(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.success.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn warning(&self, level: f32) -> Hsla {
|
pub fn warning(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.warning.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn error(&self, level: f32) -> Hsla {
|
pub fn error(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.error.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn inserted(&self, level: f32) -> Hsla {
|
pub fn inserted(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.inserted.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deleted(&self, level: f32) -> Hsla {
|
pub fn deleted(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.deleted.lerp(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn modified(&self, level: f32) -> Hsla {
|
pub fn modified(&self, level: f32) -> Hsla {
|
||||||
self.deleted.lerp(level)
|
self.modified.lerp(level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ pub struct WindowOptions<'a> {
|
||||||
pub screen: Option<Rc<dyn Screen>>,
|
pub screen: Option<Rc<dyn Screen>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
pub struct TitlebarOptions<'a> {
|
pub struct TitlebarOptions<'a> {
|
||||||
pub title: Option<&'a str>,
|
pub title: Option<&'a str>,
|
||||||
pub appears_transparent: bool,
|
pub appears_transparent: bool,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue