From 2e75d4b602096eb5d3c2851db082b53217c820ee Mon Sep 17 00:00:00 2001 From: edouard Date: Thu, 13 Apr 2023 13:15:31 +0200 Subject: [PATCH] ui: introduce dark theme colors --- gui/ui/examples/design-system/src/main.rs | 6 +-- gui/ui/examples/design-system/src/section.rs | 18 ++++++--- gui/ui/src/color.rs | 41 ++++++++++++++++++++ 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/gui/ui/examples/design-system/src/main.rs b/gui/ui/examples/design-system/src/main.rs index 56231b2b..62dc0d97 100644 --- a/gui/ui/examples/design-system/src/main.rs +++ b/gui/ui/examples/design-system/src/main.rs @@ -1,6 +1,6 @@ mod section; -use iced::widget::{button, column, container, row, text, Space}; +use iced::widget::{button, column, container, row, scrollable, text, Space}; use iced::{executor, Application, Command, Length, Settings, Subscription}; use liana_ui::{component::text::*, theme, widget::*}; @@ -128,10 +128,10 @@ impl Application for DesignSystem { container(row![ sidebar.width(Length::Units(200)), Space::with_width(Length::Units(150)), - column![ + scrollable(column![ Space::with_height(Length::Units(150)), container(self.sections[self.current].view()).width(Length::Fill) - ] + ]), ]) .width(Length::Fill) .height(Length::Fill) diff --git a/gui/ui/examples/design-system/src/section.rs b/gui/ui/examples/design-system/src/section.rs index 058f0484..ce12f39f 100644 --- a/gui/ui/examples/design-system/src/section.rs +++ b/gui/ui/examples/design-system/src/section.rs @@ -43,12 +43,18 @@ impl Section for Colors { column![ h1(self.title()), column![ - color_row(color::BLACK, "BLACK (0,0,0)"), - color_row(color::LIGHT_BLACK, "LIGHT_BLACK #141414 original design"), - color_row(color::GREEN, "GREEN #00FF66 original design"), - color_row(color::DARK_GREY, "DARK_GREY #555555"), - color_row(color::GREY, "GREY #CCCCCC original design"), - color_row(color::LIGHT_GREY, "LIGHT_GREY #E6E6E6 original design"), + color_row(color::dark::BLACK, "BLACK (0,0,0)"), + color_row( + color::dark::LIGHT_BLACK, + "LIGHT_BLACK #141414 original design" + ), + color_row(color::dark::GREEN, "GREEN #00FF66 original design"), + color_row(color::dark::GREY_5, "GREY #272727"), + color_row(color::dark::GREY_4, "GREY #424242"), + color_row(color::dark::GREY_3, "GREY #717171"), + color_row(color::dark::GREY_2, "GREY #CCCCCC"), + color_row(color::dark::GREY_1, "GREY #E6E6E6"), + color_row(color::dark::WHITE, "WHITE #FFFFFF"), color_row(color::RED, "RED #F04359"), color_row(color::ORANGE, "ORANGE #FFa700") ] diff --git a/gui/ui/src/color.rs b/gui/ui/src/color.rs index bfb37d71..0356d52e 100644 --- a/gui/ui/src/color.rs +++ b/gui/ui/src/color.rs @@ -41,6 +41,47 @@ pub const RED: Color = Color::from_rgb( pub const ORANGE: Color = Color::from_rgb(0xFF as f32 / 255.0, 0xa7 as f32 / 255.0, 0x0 as f32 / 255.0); +pub mod dark { + use iced::Color; + pub const BLACK: Color = iced::Color::BLACK; + pub const LIGHT_BLACK: Color = Color::from_rgb( + 0x14 as f32 / 255.0, + 0x14 as f32 / 255.0, + 0x14 as f32 / 255.0, + ); + pub const GREY_5: Color = Color::from_rgb( + 0x27 as f32 / 255.0, + 0x27 as f32 / 255.0, + 0x27 as f32 / 255.0, + ); + pub const GREY_4: Color = Color::from_rgb( + 0x42 as f32 / 255.0, + 0x42 as f32 / 255.0, + 0x42 as f32 / 255.0, + ); + pub const GREY_3: Color = Color::from_rgb( + 0x71 as f32 / 255.0, + 0x71 as f32 / 255.0, + 0x71 as f32 / 255.0, + ); + pub const GREY_2: Color = Color::from_rgb( + 0xCC as f32 / 255.0, + 0xCC as f32 / 255.0, + 0xCC as f32 / 255.0, + ); + pub const GREY_1: Color = Color::from_rgb( + 0xE6 as f32 / 255.0, + 0xE6 as f32 / 255.0, + 0xE6 as f32 / 255.0, + ); + pub const WHITE: Color = iced::Color::WHITE; + pub const GREEN: Color = Color::from_rgb( + 0x00 as f32 / 255.0, + 0xFF as f32 / 255.0, + 0x66 as f32 / 255.0, + ); +} + pub mod legacy { use iced::Color;