diff --git a/crates/ely_app/src/shell/chrome/mod.rs b/crates/ely_app/src/shell/chrome/mod.rs new file mode 100644 index 0000000..31db2d5 --- /dev/null +++ b/crates/ely_app/src/shell/chrome/mod.rs @@ -0,0 +1,3 @@ +pub(crate) mod wallpaper; + +pub(crate) use wallpaper::{WallpaperTheme, render_wallpaper}; diff --git a/crates/ely_app/src/shell/chrome/wallpaper.rs b/crates/ely_app/src/shell/chrome/wallpaper.rs new file mode 100644 index 0000000..cd15f8b --- /dev/null +++ b/crates/ely_app/src/shell/chrome/wallpaper.rs @@ -0,0 +1,62 @@ +use gpui::{ + Hsla, IntoElement, ParentElement, Styled, div, hsla, linear_color_stop, linear_gradient, rgb, +}; + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub(crate) enum WallpaperTheme { + Dawn, +} + +impl WallpaperTheme { + fn base(self) -> u32 { + match self { + Self::Dawn => 0xefe8e1, + } + } + + fn upper_blob(self) -> Hsla { + match self { + Self::Dawn => hsla(351.0 / 360.0, 1.0, 0.91, 0.85), + } + } + + fn lower_blob(self) -> Hsla { + match self { + Self::Dawn => hsla(228.0 / 360.0, 1.0, 0.86, 0.65), + } + } +} + +pub(crate) fn render_wallpaper(theme: WallpaperTheme) -> impl IntoElement { + let upper = theme.upper_blob(); + let lower = theme.lower_blob(); + + div() + .absolute() + .inset_0() + .bg(rgb(theme.base())) + .child( + div() + .absolute() + .inset_0() + .bg(linear_gradient( + 225.0, + linear_color_stop(upper, 0.0), + linear_color_stop(transparent_like(upper), 0.55), + )), + ) + .child( + div() + .absolute() + .inset_0() + .bg(linear_gradient( + 45.0, + linear_color_stop(lower, 0.0), + linear_color_stop(transparent_like(lower), 0.62), + )), + ) +} + +fn transparent_like(color: Hsla) -> Hsla { + hsla(color.h, color.s, color.l, 0.0) +} diff --git a/crates/ely_app/src/shell/mod.rs b/crates/ely_app/src/shell/mod.rs index fff6bd5..1ef1681 100644 --- a/crates/ely_app/src/shell/mod.rs +++ b/crates/ely_app/src/shell/mod.rs @@ -1,6 +1,7 @@ mod archive_labels; mod bookmark_files; mod bookmarks; +pub(crate) mod chrome; mod command_actions; mod download_targets; mod downloads; diff --git a/crates/ely_app/src/shell/render.rs b/crates/ely_app/src/shell/render.rs index d51b1d5..cc99f7c 100644 --- a/crates/ely_app/src/shell/render.rs +++ b/crates/ely_app/src/shell/render.rs @@ -13,6 +13,7 @@ use gpui_component::{ scroll::ScrollableElement, }; +use super::chrome::{WallpaperTheme, render_wallpaper}; use super::sidebar::{collapsed_sidebar_active, render_command_bar_identity}; use super::{ElyShell, ShellState, archive_labels::archive_detail_label}; @@ -66,12 +67,8 @@ impl ElyShell { .on_action(cx.listener(Self::on_toggle_sidebar)) .on_action(cx.listener(Self::on_zoom_in)) .on_action(cx.listener(Self::on_zoom_out)) - .bg(linear_gradient( - 135.0, - linear_color_stop(hsla(20.0 / 360.0, 0.35, 0.92, 1.0), 0.0), - linear_color_stop(hsla(220.0 / 360.0, 0.25, 0.88, 1.0), 1.0), - )) .text_color(rgb(colors::INK)) + .child(render_wallpaper(WallpaperTheme::Dawn)) .child( div() .absolute()