diff --git a/Cargo.lock b/Cargo.lock index 4177fb488..9e9dd2d7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -184,6 +184,12 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" + [[package]] name = "bitflags" version = "1.3.2" @@ -247,6 +253,12 @@ dependencies = [ "syn 2.0.18", ] +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + [[package]] name = "bytes" version = "1.4.0" @@ -385,6 +397,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + [[package]] name = "com-rs" version = "0.2.1" @@ -460,6 +478,55 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset 0.9.0", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "d3d12" version = "0.6.0" @@ -657,6 +724,22 @@ dependencies = [ "num-traits", ] +[[package]] +name = "exr" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279d3efcc55e19917fff7ab3ddd6c14afb6a90881a0078465196fe2f99d08c56" +dependencies = [ + "bit_field", + "flume", + "half", + "lebe", + "miniz_oxide 0.7.1", + "rayon-core", + "smallvec", + "zune-inflate", +] + [[package]] name = "fast-srgb8" version = "1.0.0" @@ -700,6 +783,19 @@ dependencies = [ "miniz_oxide 0.7.1", ] +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "pin-project", + "spin", +] + [[package]] name = "fontdb" version = "0.14.1" @@ -835,8 +931,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "gif" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045" +dependencies = [ + "color_quant", + "weezl", ] [[package]] @@ -936,6 +1044,16 @@ dependencies = [ "svg_fmt", ] +[[package]] +name = "half" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9906a89f1724975a455316ae0554ceaa45ad83bb336f1125a87bfbdb9197cfa0" +dependencies = [ + "cfg-if", + "crunchy", +] + [[package]] name = "halloy" version = "0.1.0" @@ -1046,6 +1164,7 @@ dependencies = [ "iced_renderer", "iced_widget", "iced_winit", + "image", "thiserror", ] @@ -1084,6 +1203,8 @@ dependencies = [ "bytemuck", "glam", "iced_core", + "image", + "kamadak-exif", "log", "raw-window-handle", "thiserror", @@ -1190,6 +1311,25 @@ dependencies = [ "winit", ] +[[package]] +name = "image" +version = "0.24.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527909aa81e20ac3a44803521443a765550f09b5130c2c2fa1ea59c2f8f50a3a" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "exr", + "gif", + "jpeg-decoder", + "num-rational", + "num-traits", + "png", + "qoi", + "tiff", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -1301,6 +1441,15 @@ dependencies = [ "libc", ] +[[package]] +name = "jpeg-decoder" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e" +dependencies = [ + "rayon", +] + [[package]] name = "js-sys" version = "0.3.63" @@ -1310,6 +1459,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kamadak-exif" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef4fc70d0ab7e5b6bafa30216a6b48705ea964cdfc29c050f2412295eba58077" +dependencies = [ + "mutate_once", +] + [[package]] name = "khronos-egl" version = "4.1.0" @@ -1336,6 +1494,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lebe" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" + [[package]] name = "libc" version = "0.2.144" @@ -1456,6 +1620,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "metal" version = "0.24.0" @@ -1507,6 +1680,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mutate_once" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16cf681a23b4d0a43fc35024c176437f9dcd818db34e0f42ab456a0ee5ad497b" + [[package]] name = "naga" version = "0.12.2" @@ -1527,6 +1706,15 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom", +] + [[package]] name = "native-tls" version = "0.2.11" @@ -1636,6 +1824,27 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -2083,6 +2292,15 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "332cd62e95873ea4f41f3dfd6bbbfc5b52aec892d7e8d534197c4720a0bbbab2" +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + [[package]] name = "quick-xml" version = "0.23.1" @@ -2149,6 +2367,28 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" +[[package]] +name = "rayon" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -2466,6 +2706,15 @@ dependencies = [ "x11rb 0.11.1", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + [[package]] name = "spirv" version = "0.2.0+1.5.4" @@ -2584,6 +2833,17 @@ dependencies = [ "syn 2.0.18", ] +[[package]] +name = "tiff" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7449334f9ff2baf290d55d73983a7d6fa15e01198faef72af07e2a8db851e471" +dependencies = [ + "flate2", + "jpeg-decoder", + "weezl", +] + [[package]] name = "time" version = "0.1.45" @@ -3101,6 +3361,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "weezl" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" + [[package]] name = "wgpu" version = "0.16.1" @@ -3552,3 +3818,12 @@ name = "zeno" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c110ba09c9b3a43edd4803d570df0da2414fed6e822e22b976a4e3ef50860701" + +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] diff --git a/Cargo.toml b/Cargo.toml index 3eb439376..70e10b39f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ data = { version = "0.1.0", path = "data" } chrono = { version = "0.4", features = ['serde'] } fern = "0.6.1" -iced = { version = "0.9", features = ["tokio", "lazy", "advanced"] } +iced = { version = "0.9", features = ["tokio", "lazy", "advanced", "image"] } log = "0.4.16" palette = "=0.7.2" thiserror = "1.0.30" diff --git a/assets/logo.png b/assets/logo.png index a1508e14c..3693b1fde 100644 Binary files a/assets/logo.png and b/assets/logo.png differ diff --git a/data/src/config.rs b/data/src/config.rs index b16742974..d62b1d4d0 100644 --- a/data/src/config.rs +++ b/data/src/config.rs @@ -51,6 +51,6 @@ pub enum Error { DirectoryCreation, #[error("config could not be read: {0}")] Read(String), - #[error("config could not be parsed: {0}")] + #[error("{0}")] Parse(String), } diff --git a/src/font.rs b/src/font.rs index 596320b9f..22f627478 100644 --- a/src/font.rs +++ b/src/font.rs @@ -6,7 +6,7 @@ pub const MONO: Font = Font { ..Font::with_name("Iosevka Term") }; -pub const _MONO_BOLD: Font = Font { +pub const MONO_BOLD: Font = Font { monospaced: true, weight: font::Weight::Bold, ..Font::with_name("Iosevka Term") diff --git a/src/icon.rs b/src/icon.rs index d4cd9ab44..6668a628f 100644 --- a/src/icon.rs +++ b/src/icon.rs @@ -6,6 +6,10 @@ use crate::{font, theme}; // Based off https://github.com/iced-rs/iced_aw/blob/main/src/graphics/icons/bootstrap.rs +pub fn error<'a>() -> Text<'a> { + to_text('\u{f33a}') +} + pub fn globe<'a>() -> Text<'a> { to_text('\u{f3ef}') } @@ -40,6 +44,7 @@ pub fn people<'a>() -> Text<'a> { fn to_text<'a>(unicode: char) -> Text<'a> { text(unicode.to_string()) + .style(theme::Text::Primary) .line_height(LineHeight::Relative(1.1)) .size(theme::ICON_SIZE) .font(font::ICON) diff --git a/src/main.rs b/src/main.rs index 71411641a..28519a540 100644 --- a/src/main.rs +++ b/src/main.rs @@ -91,14 +91,51 @@ struct Halloy { clients: data::client::Map, } -enum Screen { +impl Halloy { + pub fn load_from_configuration() -> (Halloy, Command) { + let (screen, config, command) = match Config::load() { + Ok(config) => { + let (screen, command) = screen::Dashboard::new(&config); + ( + Screen::Dashboard(screen), + config, + command.map(Message::Dashboard), + ) + } + Err(error) => match &error { + config::Error::Parse(_) => ( + Screen::Help(screen::Help::new(error)), + Config::default(), + Command::none(), + ), + _ => ( + Screen::Welcome(screen::Welcome::new()), + Config::default(), + Command::none(), + ), + }, + }; + + ( + Halloy { + screen, + theme: Theme::new_from_palette(config.palette), + config, + clients: Default::default(), + }, + command, + ) + } +} + +pub enum Screen { Dashboard(screen::Dashboard), Help(screen::Help), Welcome(screen::Welcome), } #[derive(Debug)] -enum Message { +pub enum Message { Dashboard(dashboard::Message), Stream(stream::Update), Help(help::Message), @@ -107,42 +144,43 @@ enum Message { FontsLoaded(Result<(), iced::font::Error>), } +pub fn load_configuration() -> (Screen, Config, Command) { + match Config::load() { + Ok(config) => { + let (screen, command) = screen::Dashboard::new(&config); + ( + Screen::Dashboard(screen), + config, + command.map(Message::Dashboard), + ) + } + Err(error) => match &error { + config::Error::Parse(_) => ( + Screen::Help(screen::Help::new(error)), + Config::default(), + Command::none(), + ), + _ => ( + Screen::Welcome(screen::Welcome::new()), + Config::default(), + Command::none(), + ), + }, + } +} + impl Application for Halloy { type Executor = executor::Default; type Message = Message; - type Flags = (); type Theme = theme::Theme; + type Flags = (); fn new(_flags: ()) -> (Halloy, Command) { - let (config, config_error) = match Config::load() { - Ok(config) => (config, None), - Err(error) => (Config::default(), Some(error)), - }; - - let (screen, command) = match config_error { - Some(error) => match &error { - config::Error::Parse(_) => { - (Screen::Welcome(screen::Welcome::new()), Command::none()) - } - _ => (Screen::Help(screen::Help::new(error)), Command::none()), - }, - None => { - let (screen, command) = screen::Dashboard::new(&config); - (Screen::Dashboard(screen), command) - } - }; + let (halloy, command) = Halloy::load_from_configuration(); ( - Halloy { - screen, - theme: Theme::new_from_palette(config.palette), - config, - clients: Default::default(), - }, - Command::batch(vec![ - font::load().map(Message::FontsLoaded), - command.map(Message::Dashboard), - ]), + halloy, + Command::batch(vec![font::load().map(Message::FontsLoaded), command]), ) } @@ -171,7 +209,17 @@ impl Application for Halloy { return Command::none(); }; - let _ = help.update(message); + if let Some(event) = help.update(message) { + match event { + help::Event::RefreshConfiguration => { + let (halloy, command) = Halloy::load_from_configuration(); + *self = halloy; + + return command; + } + } + } + Command::none() } Message::Welcome(message) => { diff --git a/src/screen/dashboard/side_menu.rs b/src/screen/dashboard/side_menu.rs index 2d80b9512..531966194 100644 --- a/src/screen/dashboard/side_menu.rs +++ b/src/screen/dashboard/side_menu.rs @@ -153,16 +153,24 @@ fn buffer_button<'a>( } else { icon::wifi_off() }, - text(server.to_string()) + text(server.to_string()).style(theme::Text::Primary) + ] + .spacing(8) + .align_items(iced::Alignment::Center), + Buffer::Channel(_, channel) => row![ + horizontal_space(4), + icon::chat(), + text(channel).style(theme::Text::Primary) + ] + .spacing(8) + .align_items(iced::Alignment::Center), + Buffer::Query(_, nick) => row![ + horizontal_space(4), + icon::person(), + text(nick).style(theme::Text::Primary) ] .spacing(8) .align_items(iced::Alignment::Center), - Buffer::Channel(_, channel) => row![horizontal_space(4), icon::chat(), text(channel)] - .spacing(8) - .align_items(iced::Alignment::Center), - Buffer::Query(_, nick) => row![horizontal_space(4), icon::person(), text(nick)] - .spacing(8) - .align_items(iced::Alignment::Center), }; let base = button(row) diff --git a/src/screen/help.rs b/src/screen/help.rs index a587bce41..bfdf5c0c1 100644 --- a/src/screen/help.rs +++ b/src/screen/help.rs @@ -1,14 +1,20 @@ -use data::config; -use iced::widget::{column, container, text}; +use data::{config, Config}; +use iced::widget::{button, column, container, row, text, vertical_space}; use iced::{alignment, Length}; -use crate::widget::Element; +use crate::widget::{Collection, Element}; +use crate::{font, icon, theme}; #[derive(Debug, Clone)] -pub enum Message {} +pub enum Message { + RefreshConfiguration, + OpenConfigurationDirectory, +} #[derive(Debug, Clone)] -pub enum Event {} +pub enum Event { + RefreshConfiguration, +} #[derive(Debug, Clone)] pub struct Help { @@ -20,13 +26,56 @@ impl Help { Help { error } } - pub fn update(&mut self, _message: Message) -> Option { - None + pub fn update(&mut self, message: Message) -> Option { + match message { + Message::RefreshConfiguration => Some(Event::RefreshConfiguration), + Message::OpenConfigurationDirectory => { + let Ok(config) = Config::config_dir() else { + return None + }; + + let _ = open::that(config); + + None + } + } } pub fn view<'a>(&self) -> Element<'a, Message> { + let config_button = Config::config_dir().ok().map(|_| { + button( + container(text("Open Directory")) + .align_x(alignment::Horizontal::Center) + .width(Length::Fill), + ) + .width(Length::Fill) + .style(theme::Button::Secondary) + .on_press(Message::OpenConfigurationDirectory) + }); + let refresh_button = button( + container(text("Refresh")) + .align_x(alignment::Horizontal::Center) + .width(Length::Fill), + ) + .width(Length::Fill) + .style(theme::Button::Secondary) + .on_press(Message::RefreshConfiguration); + let content = column![] - .push(text("halloy help")) + .spacing(1) + .push(icon::error().size(45)) + .push(vertical_space(10)) + .push(text("Error reading configuration file").font(font::MONO_BOLD)) + .push(vertical_space(3)) + .push(text(self.error.to_string()).style(theme::Text::Error)) + .push(vertical_space(10)) + .push( + row![] + .width(250) + .spacing(4) + .push_maybe(config_button) + .push(refresh_button), + ) .align_items(iced::Alignment::Center); container(content) diff --git a/src/screen/welcome.rs b/src/screen/welcome.rs index 888df0a8d..47abb447d 100644 --- a/src/screen/welcome.rs +++ b/src/screen/welcome.rs @@ -1,14 +1,22 @@ -use data::config; -use iced::widget::{column, container, text}; +use std::path::PathBuf; + +use data::{config, Config}; +use iced::widget::{button, column, container, image, row, text, vertical_space}; use iced::{alignment, Length}; -use crate::widget::Element; +use crate::widget::{Collection, Element}; +use crate::{font, theme}; #[derive(Debug, Clone)] -pub enum Message {} +pub enum Message { + RefreshConfiguration, + OpenConfigurationDirectory, +} #[derive(Debug, Clone)] -pub enum Event {} +pub enum Event { + RefreshConfiguration, +} #[derive(Debug, Clone)] pub struct Welcome {} @@ -23,11 +31,46 @@ impl Welcome { } pub fn view<'a>(&self) -> Element<'a, Message> { + let config_button = Config::config_dir().ok().map(|_| { + button( + container(text("Open Directory")) + .align_x(alignment::Horizontal::Center) + .width(Length::Fill), + ) + .width(Length::Fill) + .style(theme::Button::Secondary) + .on_press(Message::OpenConfigurationDirectory) + }); + + let refresh_button = button( + container(text("Refresh")) + .align_x(alignment::Horizontal::Center) + .width(Length::Fill), + ) + .width(Length::Fill) + .style(theme::Button::Secondary) + .on_press(Message::RefreshConfiguration); + let content = column![] - .push(text("halloy welcome")) + .spacing(1) + .push(image(format!("{}/assets/logo.png", env!("CARGO_MANIFEST_DIR"))).width(150)) + .push(vertical_space(10)) + .push(text("Welcome to Halloy!").font(font::MONO_BOLD)) + .push(vertical_space(4)) + .push(text( + "To get started, please create a configuration file. You can find help to create the configuration file on the website: halloy.squidowl.org", + )) + .push(vertical_space(10)) + .push( + row![] + .width(250) + .spacing(4) + .push_maybe(config_button) + .push(refresh_button), + ) .align_items(iced::Alignment::Center); - container(content) + container(container(content).width(450)) .align_x(alignment::Horizontal::Center) .align_y(alignment::Vertical::Center) .width(Length::Fill) diff --git a/src/theme.rs b/src/theme.rs index ff739f274..6d2817b51 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -150,6 +150,7 @@ impl rule::StyleSheet for Theme { pub enum Text { #[default] Default, + Primary, Alpha04, Action, Accent, @@ -163,7 +164,8 @@ impl text::StyleSheet for Theme { fn appearance(&self, style: Self::Style) -> text::Appearance { match style { - Text::Default => text::Appearance { + Text::Default => text::Appearance { color: None }, + Text::Primary => text::Appearance { color: Some(self.colors.text.base), }, Text::Alpha04 => text::Appearance { @@ -264,6 +266,7 @@ impl container::StyleSheet for Theme { pub enum Button { #[default] Default, + Secondary, SideMenu { selected: bool, }, @@ -280,8 +283,13 @@ impl button::StyleSheet for Theme { match style { Button::Default => button::Appearance { background: Some(Background::Color(self.colors.action.alpha_02)), - border_color: self.colors.action.base, - border_width: 1.0, + text_color: self.colors.action.base, + border_radius: 3.0.into(), + ..Default::default() + }, + Button::Secondary => button::Appearance { + background: Some(Background::Color(self.colors.text.alpha_02)), + text_color: self.colors.text.base, border_radius: 3.0.into(), ..Default::default() }, @@ -320,6 +328,7 @@ impl button::StyleSheet for Theme { let active = self.active(style); match style { Button::Default => button::Appearance { ..active }, + Button::Secondary => button::Appearance { ..active }, Button::SideMenu { selected: _ } => button::Appearance { ..active }, Button::Pane { selected: _ } => button::Appearance { ..active }, Button::Context => button::Appearance { ..active }, @@ -331,9 +340,14 @@ impl button::StyleSheet for Theme { match style { Button::Default => button::Appearance { - background: Some(Background::Color(self.colors.action.alpha_06)), - border_color: self.colors.action.base, - border_width: 1.0, + background: Some(Background::Color(self.colors.action.alpha_04)), + text_color: self.colors.action.base, + border_radius: 3.0.into(), + ..Default::default() + }, + Button::Secondary => button::Appearance { + background: Some(Background::Color(self.colors.text.alpha_04)), + text_color: self.colors.text.base, border_radius: 3.0.into(), ..Default::default() },