diff --git a/harbor-ui/src/components/colors.rs b/harbor-ui/src/components/colors.rs index 0b9639c7..291a9ac2 100644 --- a/harbor-ui/src/components/colors.rs +++ b/harbor-ui/src/components/colors.rs @@ -1,4 +1,6 @@ use iced::Color; -pub const MUTINY_GREEN: Color = Color::from_rgb(40. / 255., 164. / 255., 127. / 255.); -pub const MUTINY_RED: Color = Color::from_rgb(250. / 255., 0., 80. / 255.); +pub const MUTINY_GREEN: Color = Color::from_rgb8(40, 164, 127); +pub const MUTINY_RED: Color = Color::from_rgb8(250, 0, 80); +pub const BACKGROUND_GREY: Color = Color::from_rgb8(23, 23, 25); +pub const WARNING_YELLOW: Color = Color::from_rgb8(255, 165, 0); diff --git a/harbor-ui/src/components/screen_header.rs b/harbor-ui/src/components/screen_header.rs index 4d37f3ac..ed179769 100644 --- a/harbor-ui/src/components/screen_header.rs +++ b/harbor-ui/src/components/screen_header.rs @@ -1,7 +1,7 @@ use super::{ - SvgIcon, borderless_pick_list_style, format_amount, gray, green, hr, map_icon, menu_style, red, - vr, + SvgIcon, borderless_pick_list_style, format_amount, gray, hr, map_icon, menu_style, vr, }; +use crate::components::{MUTINY_GREEN, MUTINY_RED}; use crate::{HarborWallet, Message, ReceiveStatus}; use harbor_client::MintIdentifier; use harbor_client::db_models::MintItem; @@ -73,7 +73,7 @@ pub fn h_screen_header( let tor_enabled = harbor.tor_enabled; let rich_tor = rich_text([ span("Tor ").size(16).color(gray()), - span("enabled").size(16).color(green()), + span("enabled").size(16).color(MUTINY_GREEN), ]) .on_link_click(never); let secured = if tor_enabled { @@ -82,7 +82,7 @@ pub fn h_screen_header( row![ rich_text([ span("Tor ").size(16).color(gray()), - span("disabled").size(16).color(red()), + span("disabled").size(16).color(MUTINY_RED), ]) .on_link_click(never), shield_alert_icon diff --git a/harbor-ui/src/components/styles.rs b/harbor-ui/src/components/styles.rs index f2457929..b75a1356 100644 --- a/harbor-ui/src/components/styles.rs +++ b/harbor-ui/src/components/styles.rs @@ -4,6 +4,8 @@ use iced::{ widget::{checkbox, container::Style as ContainerStyle, pick_list, text::Style}, }; +use crate::components::BACKGROUND_GREY; + use super::{darken, lighten}; use iced::{ @@ -22,8 +24,8 @@ pub fn very_subtle(theme: &Theme) -> Style { } pub fn link() -> Color { - // This is the same theme.pallette().background just without needing `Theme` - lighten(Color::from_rgb8(23, 23, 25), 0.7) + // This is the same theme.palette().background just without needing `Theme` + lighten(BACKGROUND_GREY, 0.7) } const REGULAR_FONT: Font = Font { @@ -49,15 +51,7 @@ pub fn regular_text(content: String, size: u16) -> Text<'static> { } pub fn gray() -> Color { - lighten(Color::from_rgb8(23, 23, 25), 0.5) -} - -pub fn green() -> Color { - Color::from_rgb8(40, 164, 127) -} - -pub fn red() -> Color { - Color::from_rgb8(250, 0, 80) + lighten(BACKGROUND_GREY, 0.5) } pub fn menu_style(theme: &Theme) -> menu::Style { diff --git a/harbor-ui/src/main.rs b/harbor-ui/src/main.rs index 0addd90d..eedca135 100644 --- a/harbor-ui/src/main.rs +++ b/harbor-ui/src/main.rs @@ -30,7 +30,7 @@ use crate::bridge::run_core; use crate::components::confirm_modal::{BasicModalState, ConfirmModalState}; -use crate::components::focus_input_id; +use crate::components::{BACKGROUND_GREY, WARNING_YELLOW, focus_input_id}; use crate::components::{Toast, ToastManager, ToastStatus}; use crate::config::{Config, write_config}; use components::{MUTINY_GREEN, MUTINY_RED}; @@ -1396,13 +1396,12 @@ impl HarborWallet { iced::Theme::custom( String::from("Custom"), iced::theme::Palette { - background: Color::from_rgb8(23, 23, 25), + background: BACKGROUND_GREY, primary: MUTINY_RED, text: Color::WHITE, success: MUTINY_GREEN, danger: MUTINY_RED, - // TODO: do we need a warning yellow? - warning: Color::from_rgb8(255, 165, 0), + warning: WARNING_YELLOW, }, ) } diff --git a/harbor-ui/src/routes/restore.rs b/harbor-ui/src/routes/restore.rs index 98ec399e..0f27040f 100644 --- a/harbor-ui/src/routes/restore.rs +++ b/harbor-ui/src/routes/restore.rs @@ -1,6 +1,6 @@ use crate::{ UnlockStatus, WelcomeStatus, - components::{InputArgs, SvgIcon, h_button, h_input, harbor_logo, the_spinner}, + components::{InputArgs, MUTINY_RED, SvgIcon, h_button, h_input, harbor_logo, the_spinner}, }; use iced::{Alignment, Element, Length}; use iced::{ @@ -33,7 +33,7 @@ pub fn restore(harbor: &HarborWallet) -> Element { "Failed to initialize wallet. Config error: {error}" )) .size(24) - .color(iced::Color::from_rgb8(250, 0, 80)) + .color(MUTINY_RED) ] .spacing(32) .align_x(Alignment::Center) diff --git a/harbor-ui/src/routes/unlock.rs b/harbor-ui/src/routes/unlock.rs index 0a4ffcb2..d6ebaa8b 100644 --- a/harbor-ui/src/routes/unlock.rs +++ b/harbor-ui/src/routes/unlock.rs @@ -1,12 +1,9 @@ use crate::{ UnlockStatus, - components::{InputArgs, SvgIcon, h_button, h_input, harbor_logo}, + components::{InputArgs, MUTINY_RED, SvgIcon, h_button, h_input, harbor_logo}, }; +use iced::widget::{center, column, container, text}; use iced::{Alignment, Element, Length}; -use iced::{ - Color, - widget::{center, column, container, text}, -}; use crate::{HarborWallet, Message}; @@ -41,16 +38,17 @@ pub fn unlock(harbor: &HarborWallet) -> Element { .align_x(Alignment::Center) .width(Length::Fixed(256.)); - let page_column = page_column.push_maybe(harbor.unlock_failure_reason.as_ref().map(|r| { - text(format!("Error: {r:?}")) - .size(24) - .color(Color::from_rgb8(250, 0, 80)) - })); + let page_column = page_column.push_maybe( + harbor + .unlock_failure_reason + .as_ref() + .map(|r| text(format!("Error: {r:?}")).size(24).color(MUTINY_RED)), + ); let page_column = page_column.push_maybe(harbor.init_failure_reason.as_ref().map(|r| { text(format!("Init Error: {r:?}")) .size(24) - .color(Color::from_rgb8(250, 0, 80)) + .color(MUTINY_RED) })); container(center(page_column)).into() diff --git a/harbor-ui/src/routes/welcome.rs b/harbor-ui/src/routes/welcome.rs index 35eb808b..8de7d59c 100644 --- a/harbor-ui/src/routes/welcome.rs +++ b/harbor-ui/src/routes/welcome.rs @@ -1,3 +1,4 @@ +use crate::components::MUTINY_RED; use crate::routes::Route; use crate::{HarborWallet, Message}; use crate::{ @@ -33,7 +34,7 @@ pub fn welcome(harbor: &HarborWallet) -> Element { "Failed to initialize wallet. Config error: {error}" )) .size(24) - .color(iced::Color::from_rgb8(250, 0, 80)) + .color(MUTINY_RED) ] .spacing(32) .align_x(Alignment::Center)