diff --git a/src/ui/components/confirmation_dialog.rs b/src/ui/components/confirmation_dialog.rs index 1dcf86ff3..733ce02d1 100644 --- a/src/ui/components/confirmation_dialog.rs +++ b/src/ui/components/confirmation_dialog.rs @@ -153,7 +153,7 @@ impl ConfirmationDialog { painter.rect_filled( screen_rect, 0.0, - egui::Color32::from_rgba_unmultiplied(0, 0, 0, 120), // Semi-transparent black overlay + DashColors::modal_overlay(), // Semi-transparent black overlay ); let mut final_response = None; @@ -170,13 +170,10 @@ impl ConfirmationDialog { offset: [0, 8], blur: 16, spread: 0, - color: egui::Color32::from_rgba_unmultiplied(0, 0, 0, 100), + color: DashColors::popup_shadow(), }, fill: ui.style().visuals.window_fill, - stroke: egui::Stroke::new( - 1.0, - egui::Color32::from_rgba_unmultiplied(255, 255, 255, 30), - ), + stroke: egui::Stroke::new(1.0, DashColors::popup_border_glow()), }) .show(ui.ctx(), |ui| { // Set minimum width for the dialog diff --git a/src/ui/components/entropy_grid.rs b/src/ui/components/entropy_grid.rs index 8f7b2012d..d60ed442f 100644 --- a/src/ui/components/entropy_grid.rs +++ b/src/ui/components/entropy_grid.rs @@ -1,6 +1,6 @@ use crate::ui::theme::DashColors; use bip39::rand::{self, Rng}; -use egui::{Button, Color32, Grid, Ui, Vec2}; +use egui::{Button, Grid, Ui, Vec2}; pub struct U256EntropyGrid { random_number: [u8; 32], // Current 256-bit number (32 bytes) @@ -73,9 +73,9 @@ impl U256EntropyGrid { } else { // Off squares: gray in dark mode, white in light mode if dark_mode { - Color32::from_rgb(80, 80, 80) + DashColors::ENTROPY_OFF_DARK } else { - Color32::WHITE + DashColors::WHITE } }; diff --git a/src/ui/components/info_popup.rs b/src/ui/components/info_popup.rs index 0119fe64b..57614471c 100644 --- a/src/ui/components/info_popup.rs +++ b/src/ui/components/info_popup.rs @@ -61,11 +61,7 @@ impl InfoPopup { egui::Order::Background, egui::Id::new("info_popup_overlay"), )); - painter.rect_filled( - screen_rect, - 0.0, - egui::Color32::from_rgba_unmultiplied(0, 0, 0, 120), - ); + painter.rect_filled(screen_rect, 0.0, DashColors::modal_overlay()); let mut was_closed = false; let is_markdown = self.markdown; @@ -84,13 +80,10 @@ impl InfoPopup { offset: [0, 8], blur: 16, spread: 0, - color: egui::Color32::from_rgba_unmultiplied(0, 0, 0, 100), + color: DashColors::popup_shadow(), }, fill: ui.style().visuals.window_fill, - stroke: egui::Stroke::new( - 1.0, - egui::Color32::from_rgba_unmultiplied(255, 255, 255, 30), - ), + stroke: egui::Stroke::new(1.0, DashColors::popup_border_glow()), }) .show(ui.ctx(), |ui| { // Set minimum and maximum width for the popup diff --git a/src/ui/components/left_panel.rs b/src/ui/components/left_panel.rs index 6d082e719..79135b943 100644 --- a/src/ui/components/left_panel.rs +++ b/src/ui/components/left_panel.rs @@ -5,7 +5,7 @@ use crate::ui::components::styled::GradientButton; use crate::ui::theme::{DashColors, Shadow, Shape, Spacing}; use dash_sdk::dashcore_rpc::dashcore::Network; use eframe::epaint::Margin; -use egui::{Color32, Context, Frame, Image, RichText, SidePanel, TextureHandle}; +use egui::{Context, Frame, Image, RichText, SidePanel, TextureHandle}; use egui_extras::{Size, StripBuilder}; use rust_embed::RustEmbed; use std::sync::Arc; @@ -241,13 +241,7 @@ pub fn add_left_panel( _ => selected_screen == *screen_type, }; - let button_color = if is_selected { - Color32::WHITE - } else if dark_mode { - Color32::from_rgb(180, 180, 180) - } else { - Color32::from_rgb(160, 160, 160) - }; + let button_color = DashColors::icon_tint(is_selected, dark_mode); if let Some(ref texture) = texture { let button = egui::Button::image( @@ -344,15 +338,15 @@ pub fn add_left_panel( let (network_name, network_color) = match app_context.network { Network::Testnet => ( "Testnet", - Color32::from_rgb(255, 165, 0), + DashColors::TESTNET_ORANGE, ), Network::Devnet => ( "Devnet", - Color32::DARK_RED, + DashColors::DEVNET_RED, ), Network::Regtest => ( "Local Network", - Color32::from_rgb(139, 69, 19), + DashColors::REGTEST_BROWN, ), _ => ("Unknown", DashColors::DASH_BLUE), }; diff --git a/src/ui/components/left_wallet_panel.rs b/src/ui/components/left_wallet_panel.rs index c7412debe..aae81dda2 100644 --- a/src/ui/components/left_wallet_panel.rs +++ b/src/ui/components/left_wallet_panel.rs @@ -1,7 +1,8 @@ use crate::app::AppAction; use crate::context::AppContext; use crate::ui::RootScreenType; -use eframe::epaint::{Color32, Margin}; +use crate::ui::theme::DashColors; +use eframe::epaint::Margin; use egui::{Context, Frame, Image, SidePanel, TextureHandle}; use rust_embed::RustEmbed; use std::sync::Arc; @@ -86,9 +87,9 @@ pub fn add_left_panel( let texture: Option = load_icon(ctx, icon_path); let is_selected = selected_screen == *screen_type; let button_color = if is_selected { - Color32::from_rgb(100, 149, 237) // Highlighted blue color for selected + DashColors::ICON_SELECTED_BLUE // Highlighted blue color for selected } else { - Color32::from_rgb(169, 169, 169) // Default gray color for unselected + DashColors::ICON_UNSELECTED // Default gray color for unselected }; // Add icon-based button if texture is loaded diff --git a/src/ui/components/styled.rs b/src/ui/components/styled.rs index ad83e5799..3d0a2fbb9 100644 --- a/src/ui/components/styled.rs +++ b/src/ui/components/styled.rs @@ -75,7 +75,7 @@ impl StyledButton { ButtonVariant::Danger => ( DashColors::WHITE, DashColors::ERROR, - Color32::from_rgb(200, 0, 0), + DashColors::DANGER_HOVER, None, ), ButtonVariant::Ghost => ( diff --git a/src/ui/components/top_panel.rs b/src/ui/components/top_panel.rs index b11293585..bac418abe 100644 --- a/src/ui/components/top_panel.rs +++ b/src/ui/components/top_panel.rs @@ -5,8 +5,7 @@ use crate::context::AppContext; use crate::spv::CoreBackendMode; use crate::ui::ScreenType; use crate::ui::theme::{DashColors, Shadow, Shape}; -use dash_sdk::dashcore_rpc::dashcore::Network; -use egui::{Color32, Context, Frame, Margin, RichText, Stroke, TextureHandle, TopBottomPanel, Ui}; +use egui::{Context, Frame, Margin, RichText, Stroke, TextureHandle, TopBottomPanel, Ui}; use rust_embed::RustEmbed; use std::sync::Arc; use tracing::error; @@ -185,43 +184,7 @@ pub fn add_top_panel( ) -> AppAction { let mut action = AppAction::None; let dark_mode = ctx.style().visuals.dark_mode; - let network_accent = match app_context.network { - Network::Dash => { - if dark_mode { - Color32::from_rgb(0, 113, 182) // Muted blue for dark mode (20% darker) - } else { - DashColors::DASH_BLUE // Original: rgb(0, 141, 228) - } - } - Network::Testnet => { - if dark_mode { - Color32::from_rgb(204, 132, 0) // Muted orange for dark mode - } else { - Color32::from_rgb(255, 165, 0) // Original bright orange for light mode - } - } - Network::Devnet => { - if dark_mode { - Color32::from_rgb(111, 0, 0) // Muted dark red for dark mode (20% darker) - } else { - Color32::DARK_RED // Original: rgb(139, 0, 0) - } - } - Network::Regtest => { - if dark_mode { - Color32::from_rgb(111, 55, 15) // Muted brown for dark mode (20% darker) - } else { - Color32::from_rgb(139, 69, 19) // Original brown - } - } - _ => { - if dark_mode { - Color32::from_rgb(0, 113, 182) // Muted blue for dark mode - } else { - DashColors::DASH_BLUE - } - } - }; + let network_accent = DashColors::network_accent(app_context.network, dark_mode); TopBottomPanel::top("top_panel") .frame( @@ -297,7 +260,7 @@ pub fn add_top_panel( // give it the same style as your other buttons let docs_btn = egui::Button::new( - RichText::new("Documents").color(Color32::WHITE), + RichText::new("Documents").color(DashColors::WHITE), ) .fill(network_accent) .frame(true) @@ -319,11 +282,10 @@ pub fn add_top_panel( resp.clicked().then_some(egui::SetOpenCommand::Toggle), ) .close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside) - .frame(egui::Frame::popup(ui.style()).fill(if dark_mode { - Color32::from_rgb(40, 40, 40) - } else { - Color32::WHITE - })) + .frame( + egui::Frame::popup(ui.style()) + .fill(DashColors::popup_fill(dark_mode)), + ) .show(|ui| { ui.set_min_width(150.0); for (text, da) in doc_actions { @@ -346,7 +308,7 @@ pub fn add_top_panel( ui.add_space(3.0); let contracts_btn = egui::Button::new( - RichText::new("Contracts").color(Color32::WHITE), + RichText::new("Contracts").color(DashColors::WHITE), ) .fill(network_accent) .frame(true) @@ -368,11 +330,10 @@ pub fn add_top_panel( resp.clicked().then_some(egui::SetOpenCommand::Toggle), ) .close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside) - .frame(egui::Frame::popup(ui.style()).fill(if dark_mode { - Color32::from_rgb(40, 40, 40) - } else { - Color32::WHITE - })) + .frame( + egui::Frame::popup(ui.style()) + .fill(DashColors::popup_fill(dark_mode)), + ) .show(|ui| { ui.set_min_width(150.0); for (text, ca) in contract_actions { @@ -400,14 +361,14 @@ pub fn add_top_panel( f.layout_no_wrap( text.to_string(), font.clone(), - Color32::WHITE, + DashColors::WHITE, ) }) .size(); let width = text_size.x + 12.0; let button = egui::Button::new( - RichText::new(text).color(Color32::WHITE), + RichText::new(text).color(DashColors::WHITE), ) .fill(network_accent) .frame(true) diff --git a/src/ui/components/wallet_unlock.rs b/src/ui/components/wallet_unlock.rs index d1d999a26..67b695035 100644 --- a/src/ui/components/wallet_unlock.rs +++ b/src/ui/components/wallet_unlock.rs @@ -1,7 +1,7 @@ use crate::context::AppContext; use crate::model::wallet::Wallet; use crate::ui::components::styled::StyledCheckbox; -use eframe::epaint::Color32; +use crate::ui::theme::DashColors; use egui::{Frame, Margin, RichText, Ui}; use std::sync::{Arc, RwLock}; use zeroize::Zeroize; @@ -78,10 +78,8 @@ pub trait ScreenWithWalletUnlock { egui::TextEdit::singleline(wallet_password_mut) .password(!local_show_password) .hint_text("Enter password") - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background( - dark_mode, - )), + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)), ); if password_input.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter)) @@ -134,7 +132,7 @@ pub trait ScreenWithWalletUnlock { // Display error message if the password was incorrect if let Some(error_message) = self.error_message().cloned() { ui.add_space(5.0); - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::error_color(ui.ctx().style().visuals.dark_mode); Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) diff --git a/src/ui/components/wallet_unlock_popup.rs b/src/ui/components/wallet_unlock_popup.rs index 0f8d65a48..5ad33d477 100644 --- a/src/ui/components/wallet_unlock_popup.rs +++ b/src/ui/components/wallet_unlock_popup.rs @@ -80,11 +80,7 @@ impl WalletUnlockPopup { egui::Order::Background, egui::Id::new("wallet_unlock_popup_overlay"), )); - painter.rect_filled( - screen_rect, - 0.0, - egui::Color32::from_rgba_unmultiplied(0, 0, 0, 120), - ); + painter.rect_filled(screen_rect, 0.0, DashColors::modal_overlay()); let mut result = WalletUnlockResult::Pending; @@ -110,13 +106,10 @@ impl WalletUnlockPopup { offset: [0, 8], blur: 16, spread: 0, - color: egui::Color32::from_rgba_unmultiplied(0, 0, 0, 100), + color: DashColors::popup_shadow(), }, fill: ctx.style().visuals.window_fill, - stroke: egui::Stroke::new( - 1.0, - egui::Color32::from_rgba_unmultiplied(255, 255, 255, 30), - ), + stroke: egui::Stroke::new(1.0, DashColors::popup_border_glow()), }) .show(ctx, |ui| { ui.set_min_width(350.0); @@ -164,7 +157,7 @@ impl WalletUnlockPopup { // Error message if let Some(error) = &self.error_message { ui.add_space(8.0); - ui.colored_label(egui::Color32::from_rgb(220, 80, 80), error); + ui.colored_label(DashColors::ERROR, error); } ui.add_space(16.0); diff --git a/src/ui/contracts_documents/add_contracts_screen.rs b/src/ui/contracts_documents/add_contracts_screen.rs index 924df137c..a0d69c5c4 100644 --- a/src/ui/contracts_documents/add_contracts_screen.rs +++ b/src/ui/contracts_documents/add_contracts_screen.rs @@ -5,6 +5,7 @@ use crate::context::AppContext; use crate::ui::components::left_panel::add_left_panel; use crate::ui::components::styled::island_central_panel; use crate::ui::components::top_panel::add_top_panel; +use crate::ui::theme::DashColors; use crate::ui::{BackendTaskSuccessResult, MessageType, ScreenLike}; use dash_sdk::dpp::data_contract::accessors::v0::DataContractV0Getters; use dash_sdk::dpp::identifier::Identifier; @@ -253,7 +254,7 @@ impl AddContractsScreen { ui.add_space(20.0); let button = egui::Button::new(RichText::new("Back to Contracts").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); if ui.add(button).clicked() { @@ -330,7 +331,7 @@ impl ScreenLike for AddContractsScreen { match &self.add_contracts_status { AddContractsStatus::NotStarted | AddContractsStatus::ErrorMessage(_) => { if let AddContractsStatus::ErrorMessage(msg) = &self.add_contracts_status { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) @@ -358,7 +359,7 @@ impl ScreenLike for AddContractsScreen { // Add Contracts Button let button = egui::Button::new(RichText::new("Add Contracts").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); if ui.add(button).clicked() { diff --git a/src/ui/contracts_documents/contracts_documents_screen.rs b/src/ui/contracts_documents/contracts_documents_screen.rs index b13c486e4..66b1895c8 100644 --- a/src/ui/contracts_documents/contracts_documents_screen.rs +++ b/src/ui/contracts_documents/contracts_documents_screen.rs @@ -187,15 +187,15 @@ impl DocumentQueryScreen { ui.add( egui::TextEdit::singleline(&mut self.document_query) .desired_width(text_width) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)), + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)), ); ui.add_space(spacing); let button_fetch = egui::Button::new(egui::RichText::new("Fetch Documents").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0) .min_size(egui::vec2(button_width - spacing, 0.0)); @@ -478,8 +478,8 @@ impl DocumentQueryScreen { egui::TextEdit::multiline(&mut combined_string) .desired_rows(10) // Remove desired_width to respect parent container margins - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .font(egui::TextStyle::Monospace), ); } diff --git a/src/ui/contracts_documents/document_action_screen.rs b/src/ui/contracts_documents/document_action_screen.rs index 5aaab004d..f6661b06d 100644 --- a/src/ui/contracts_documents/document_action_screen.rs +++ b/src/ui/contracts_documents/document_action_screen.rs @@ -618,7 +618,7 @@ impl DocumentActionScreen { } } else if self.broadcast_status == BroadcastStatus::Fetched { ui.add_space(10.0); - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::error_color(ui.visuals().dark_mode); Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) @@ -913,7 +913,7 @@ impl DocumentActionScreen { }; let button = egui::Button::new(RichText::new(button_text).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0) .min_size(egui::vec2(100.0, 30.0)); @@ -1798,7 +1798,7 @@ impl DocumentActionScreen { if let Some(ref msg) = self.backend_message { ui.add_space(10.0); - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::error_color(ui.visuals().dark_mode); let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/contracts_documents/group_actions_screen.rs b/src/ui/contracts_documents/group_actions_screen.rs index 2c4e1eb52..278376cea 100644 --- a/src/ui/contracts_documents/group_actions_screen.rs +++ b/src/ui/contracts_documents/group_actions_screen.rs @@ -20,6 +20,7 @@ use crate::ui::components::left_panel::add_left_panel; use crate::ui::components::styled::island_central_panel; use crate::ui::components::top_panel::add_top_panel; use crate::ui::helpers::add_contract_chooser_pre_filtered; +use crate::ui::theme::DashColors; use crate::ui::tokens::burn_tokens_screen::BurnTokensScreen; use crate::ui::tokens::destroy_frozen_funds_screen::DestroyFrozenFundsScreen; use crate::ui::tokens::freeze_tokens_screen::FreezeTokensScreen; @@ -237,7 +238,7 @@ impl GroupActionsScreen { egui::Button::new( RichText::new("Take Action").color(Color32::WHITE), ) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true), ) .clicked() @@ -555,7 +556,7 @@ impl ScreenLike for GroupActionsScreen { ui.add_space(10.0); let button = egui::Button::new(RichText::new("Fetch Group Actions").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); @@ -573,7 +574,7 @@ impl ScreenLike for GroupActionsScreen { match &self.fetch_group_actions_status { FetchGroupActionsStatus::ErrorMessage(msg) => { ui.add_space(10.0); - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/contracts_documents/register_contract_screen.rs b/src/ui/contracts_documents/register_contract_screen.rs index 7b16edcc8..c565754fe 100644 --- a/src/ui/contracts_documents/register_contract_screen.rs +++ b/src/ui/contracts_documents/register_contract_screen.rs @@ -15,6 +15,7 @@ use crate::ui::components::wallet_unlock_popup::{ }; use crate::ui::helpers::{TransactionType, add_key_chooser}; use crate::ui::identities::get_selected_wallet; +use crate::ui::theme::DashColors; use crate::ui::{BackendTaskSuccessResult, MessageType, ScreenLike}; use dash_sdk::dpp::data_contract::accessors::v0::DataContractV0Setters; use dash_sdk::dpp::data_contract::conversion::json::DataContractJsonConversionMethodsV0; @@ -159,8 +160,8 @@ impl RegisterDataContractScreen { TextEdit::multiline(&mut self.contract_json_input) .desired_rows(12) .desired_width(ui.available_width()) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .code_editor(), ); if response.changed() { @@ -177,7 +178,8 @@ impl RegisterDataContractScreen { }; if let Some(msg) = error_msg { - let error_color = Color32::from_rgb(255, 100, 100); + let dark_mode = ui.ctx().style().visuals.dark_mode; + let error_color = DashColors::error_color(dark_mode); Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) @@ -223,18 +225,18 @@ impl RegisterDataContractScreen { ui.add_space(10.0); let dark_mode = ui.ctx().style().visuals.dark_mode; Frame::new() - .fill(crate::ui::theme::DashColors::surface(dark_mode)) + .fill(DashColors::surface(dark_mode)) .inner_margin(Margin::symmetric(10, 8)) .corner_radius(5.0) .show(ui, |ui| { ui.horizontal(|ui| { ui.label( RichText::new("Estimated Fee:") - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.label( RichText::new(format_credits_as_dash(estimated_fee)) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)) + .color(DashColors::text_primary(dark_mode)) .strong(), ); }); @@ -247,7 +249,7 @@ impl RegisterDataContractScreen { ui.set_style(new_style); let button = egui::Button::new(RichText::new("Register Contract").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); if ui.add(button).clicked() { @@ -557,7 +559,7 @@ impl ScreenLike for RegisterDataContractScreen { ui.add(egui::Hyperlink::from_label_and_url( RichText::new("dashpay.io") .underline() - .color(Color32::from_rgb(0, 128, 255)), + .color(DashColors::ACTION_BUTTON_BLUE), "https://dashpay.io", )); }); diff --git a/src/ui/contracts_documents/update_contract_screen.rs b/src/ui/contracts_documents/update_contract_screen.rs index 58bd38372..e5c12fdcf 100644 --- a/src/ui/contracts_documents/update_contract_screen.rs +++ b/src/ui/contracts_documents/update_contract_screen.rs @@ -16,6 +16,7 @@ use crate::ui::components::wallet_unlock_popup::{ }; use crate::ui::helpers::{TransactionType, add_key_chooser}; use crate::ui::identities::get_selected_wallet; +use crate::ui::theme::DashColors; use crate::ui::{BackendTaskSuccessResult, MessageType, ScreenLike}; use dash_sdk::dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dash_sdk::dpp::data_contract::conversion::json::DataContractJsonConversionMethodsV0; @@ -172,8 +173,8 @@ impl UpdateDataContractScreen { TextEdit::multiline(&mut self.contract_json_input) .desired_rows(6) .desired_width(ui.available_width()) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .code_editor(), ); if response.changed() { @@ -191,7 +192,7 @@ impl UpdateDataContractScreen { }; if let Some(msg) = error_msg { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) @@ -233,19 +234,19 @@ impl UpdateDataContractScreen { let dark_mode = ui.ctx().style().visuals.dark_mode; Frame::new() - .fill(crate::ui::theme::DashColors::surface(dark_mode)) + .fill(DashColors::surface(dark_mode)) .inner_margin(Margin::symmetric(10, 8)) .corner_radius(5.0) .show(ui, |ui| { ui.horizontal(|ui| { ui.label( RichText::new("Estimated fee:") - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)) + .color(DashColors::text_secondary(dark_mode)) .size(14.0), ); ui.label( RichText::new(format_credits_as_dash(estimated_fee)) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)) + .color(DashColors::text_primary(dark_mode)) .size(14.0), ); }); @@ -258,7 +259,7 @@ impl UpdateDataContractScreen { ui.set_style(new_style); let button = egui::Button::new(RichText::new("Update Contract").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); if ui.add(button).clicked() { diff --git a/src/ui/dashpay/add_contact_screen.rs b/src/ui/dashpay/add_contact_screen.rs index 22a8a5fc0..f59ee79df 100644 --- a/src/ui/dashpay/add_contact_screen.rs +++ b/src/ui/dashpay/add_contact_screen.rs @@ -357,7 +357,7 @@ impl ScreenLike for AddContactScreen { if let ContactRequestStatus::Error(ref err) = self.status { let dark_mode = ui.ctx().style().visuals.dark_mode; let error_color = if dark_mode { - egui::Color32::from_rgb(255, 100, 100) + DashColors::ERROR } else { egui::Color32::DARK_RED }; diff --git a/src/ui/dashpay/contact_requests.rs b/src/ui/dashpay/contact_requests.rs index b62dcda60..2bc93b72c 100644 --- a/src/ui/dashpay/contact_requests.rs +++ b/src/ui/dashpay/contact_requests.rs @@ -401,7 +401,7 @@ impl ContactRequests { if let Some(err) = self.error.clone() { let dark_mode = ui.ctx().style().visuals.dark_mode; let error_color = if dark_mode { - egui::Color32::from_rgb(255, 100, 100) + DashColors::ERROR } else { egui::Color32::DARK_RED }; diff --git a/src/ui/dashpay/mod.rs b/src/ui/dashpay/mod.rs index fa094ef62..d6d81f77c 100644 --- a/src/ui/dashpay/mod.rs +++ b/src/ui/dashpay/mod.rs @@ -18,6 +18,7 @@ pub use profile_search::ProfileSearchScreen; use crate::app::AppAction; use crate::context::AppContext; use crate::ui::ScreenType; +use crate::ui::theme::DashColors; use chrono::{LocalResult, TimeZone, Utc}; use chrono_humanize::HumanTime; @@ -66,7 +67,7 @@ pub fn render_no_identities_card(ui: &mut Ui, app_context: &Arc) -> RichText::new("No Identities Loaded") .strong() .size(25.0) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)), + .color(DashColors::text_primary(dark_mode)), ); ui.add_space(5.0); @@ -83,7 +84,7 @@ pub fn render_no_identities_card(ui: &mut Ui, app_context: &Arc) -> RichText::new("Here's what you can do:") .strong() .size(18.0) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)), + .color(DashColors::text_primary(dark_mode)), ); ui.add_space(5.0); @@ -98,7 +99,7 @@ pub fn render_no_identities_card(ui: &mut Ui, app_context: &Arc) -> .color(egui::Color32::WHITE) .strong(), ) - .fill(crate::ui::theme::DashColors::DASH_BLUE) + .fill(DashColors::DASH_BLUE) .min_size(egui::vec2(150.0, 36.0)); if ui.add(button).clicked() { diff --git a/src/ui/dashpay/qr_scanner.rs b/src/ui/dashpay/qr_scanner.rs index af4695ddc..294180b4d 100644 --- a/src/ui/dashpay/qr_scanner.rs +++ b/src/ui/dashpay/qr_scanner.rs @@ -15,6 +15,7 @@ use crate::ui::components::wallet_unlock_popup::{ }; use crate::ui::dashpay::dashpay_screen::DashPaySubscreen; use crate::ui::identities::get_selected_wallet; +use crate::ui::theme::DashColors; use crate::ui::{MessageType, RootScreenType, ScreenLike}; use dash_sdk::dpp::identity::accessors::IdentityGettersV0; use dash_sdk::dpp::identity::{KeyType, Purpose, SecurityLevel}; @@ -125,9 +126,9 @@ impl QRScannerScreen { // Show message if any if let Some((message, message_type)) = &self.message { let color = match message_type { - MessageType::Success => crate::ui::theme::DashColors::success_color(dark_mode), - MessageType::Error => crate::ui::theme::DashColors::error_color(dark_mode), - MessageType::Info => crate::ui::theme::DashColors::DASH_BLUE, + MessageType::Success => DashColors::success_color(dark_mode), + MessageType::Error => DashColors::error_color(dark_mode), + MessageType::Info => DashColors::DASH_BLUE, }; ui.colored_label(color, message); ui.add_space(10.0); diff --git a/src/ui/dpns/dpns_contested_names_screen.rs b/src/ui/dpns/dpns_contested_names_screen.rs index 65a75bde7..3eaa52154 100644 --- a/src/ui/dpns/dpns_contested_names_screen.rs +++ b/src/ui/dpns/dpns_contested_names_screen.rs @@ -1551,7 +1551,7 @@ impl DPNSScreen { // "Apply Votes" button let button = egui::Button::new(RichText::new("Apply Votes").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .corner_radius(3.0); if ui.add(button).clicked() { action = self.bulk_apply_votes(); diff --git a/src/ui/helpers.rs b/src/ui/helpers.rs index 77bded3af..864121725 100644 --- a/src/ui/helpers.rs +++ b/src/ui/helpers.rs @@ -5,6 +5,7 @@ use crate::{ context::AppContext, model::{qualified_contract::QualifiedContract, qualified_identity::QualifiedIdentity}, ui::contracts_documents::group_actions_screen::GroupActionsScreen, + ui::theme::DashColors, ui::{RootScreenType, Screen, identities::keys::add_key_screen::AddKeyScreen}, }; use arboard::Clipboard; @@ -964,13 +965,13 @@ pub fn show_success_screen_with_info( egui::RichText::new(title) .size(16.0) .strong() - .color(crate::ui::theme::DashColors::text_primary(dark_mode)), + .color(DashColors::text_primary(dark_mode)), ); ui.add_space(8.0); ui.label( egui::RichText::new(description) .size(14.0) - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); }, ); @@ -1055,13 +1056,13 @@ pub fn show_group_token_success_screen_with_fee( egui::RichText::new(title) .size(16.0) .strong() - .color(crate::ui::theme::DashColors::text_primary(dark_mode)), + .color(DashColors::text_primary(dark_mode)), ); ui.add_space(8.0); ui.label( egui::RichText::new(description) .size(14.0) - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); }, ); diff --git a/src/ui/identities/add_existing_identity_screen.rs b/src/ui/identities/add_existing_identity_screen.rs index a62fa4afc..699b1a0e5 100644 --- a/src/ui/identities/add_existing_identity_screen.rs +++ b/src/ui/identities/add_existing_identity_screen.rs @@ -11,6 +11,7 @@ use crate::ui::components::top_panel::add_top_panel; use crate::ui::components::wallet_unlock_popup::{ WalletUnlockPopup, WalletUnlockResult, try_open_wallet_no_password, wallet_needs_unlock, }; +use crate::ui::theme::DashColors; use crate::ui::{MessageType, ScreenLike}; use bip39::rand::{prelude::IteratorRandom, thread_rng}; use dash_sdk::dashcore_rpc::dashcore::Network; @@ -443,9 +444,9 @@ impl AddExistingIdentityScreen { let button = egui::Button::new(RichText::new("Load Identity").color(Color32::WHITE)) .fill(if is_valid_id { - Color32::from_rgb(0, 128, 255) + DashColors::DASH_BLUE } else { - Color32::from_rgb(100, 100, 100) + DashColors::BUTTON_DISABLED }) .frame(true) .corner_radius(3.0); @@ -469,7 +470,7 @@ impl AddExistingIdentityScreen { RichText::new( "Invalid Identity ID format. Must be valid Base58 or Hex (64 characters).", ) - .color(Color32::from_rgb(255, 150, 100)), + .color(DashColors::VALIDATION_WARNING), ); } @@ -648,7 +649,7 @@ impl AddExistingIdentityScreen { ui.set_style(new_style); let button = egui::Button::new(RichText::new(button_label).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::DASH_BLUE) .frame(true) .corner_radius(3.0); @@ -802,9 +803,9 @@ impl AddExistingIdentityScreen { let button = egui::Button::new(RichText::new("Search by Username").color(Color32::WHITE)) .fill(if is_valid { - Color32::from_rgb(0, 128, 255) + DashColors::DASH_BLUE } else { - Color32::from_rgb(100, 100, 100) + DashColors::BUTTON_DISABLED }) .frame(true) .corner_radius(3.0); @@ -1019,7 +1020,7 @@ impl ScreenLike for AddExistingIdentityScreen { // Display error message at the top, outside of scroll area if let Some(error_message) = self.error_message.clone() { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) @@ -1144,7 +1145,7 @@ impl ScreenLike for AddExistingIdentityScreen { } } AddIdentityStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/identities/add_new_identity_screen/by_platform_address.rs b/src/ui/identities/add_new_identity_screen/by_platform_address.rs index 72cee4d83..4984d30df 100644 --- a/src/ui/identities/add_new_identity_screen/by_platform_address.rs +++ b/src/ui/identities/add_new_identity_screen/by_platform_address.rs @@ -6,6 +6,7 @@ use crate::ui::components::component_trait::{Component, ComponentResponse}; use crate::ui::identities::add_new_identity_screen::{ AddNewIdentityScreen, FundingMethod, WalletFundedScreenStep, }; +use crate::ui::theme::DashColors; use dash_sdk::dpp::address_funds::PlatformAddress; use egui::{Color32, ComboBox, RichText, Ui}; @@ -213,18 +214,18 @@ impl AddNewIdentityScreen { // Display estimated fee before action button (reuse already calculated value) let dark_mode = ui.ctx().style().visuals.dark_mode; egui::Frame::new() - .fill(crate::ui::theme::DashColors::surface(dark_mode)) + .fill(DashColors::surface(dark_mode)) .inner_margin(egui::Margin::symmetric(10, 8)) .corner_radius(5.0) .show(ui, |ui| { ui.horizontal(|ui| { ui.label( RichText::new("Estimated Fee:") - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.label( RichText::new(format_credits_as_dash(estimated_fee)) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)) + .color(DashColors::text_primary(dark_mode)) .strong(), ); }); @@ -241,9 +242,9 @@ impl AddNewIdentityScreen { let button = egui::Button::new(RichText::new("Create Identity").color(Color32::WHITE)) .fill(if can_create { - Color32::from_rgb(0, 128, 255) + DashColors::DASH_BLUE } else { - Color32::from_rgb(100, 100, 100) + DashColors::BUTTON_DISABLED }) .frame(true) .corner_radius(3.0); diff --git a/src/ui/identities/add_new_identity_screen/by_using_unused_asset_lock.rs b/src/ui/identities/add_new_identity_screen/by_using_unused_asset_lock.rs index faa61f56e..c79213538 100644 --- a/src/ui/identities/add_new_identity_screen/by_using_unused_asset_lock.rs +++ b/src/ui/identities/add_new_identity_screen/by_using_unused_asset_lock.rs @@ -3,7 +3,8 @@ use crate::model::fee_estimation::format_credits_as_dash; use crate::ui::identities::add_new_identity_screen::{ AddNewIdentityScreen, FundingMethod, WalletFundedScreenStep, }; -use egui::{Color32, RichText, Ui}; +use crate::ui::theme::DashColors; +use egui::{RichText, Ui}; impl AddNewIdentityScreen { fn render_choose_funding_asset_lock(&mut self, ui: &mut egui::Ui) { @@ -48,10 +49,7 @@ impl AddNewIdentityScreen { // Display asset lock information with "Selected" if this one is selected if Some(index) == selected_index { - ui.colored_label( - Color32::from_rgb(0, 130, 90), - "Selected asset lock", - ); + ui.colored_label(DashColors::SUCCESS, "Selected asset lock"); } ui.label(format!("TxID: {}", tx_id)); @@ -111,18 +109,18 @@ impl AddNewIdentityScreen { ui.add_space(10.0); let dark_mode = ui.ctx().style().visuals.dark_mode; egui::Frame::new() - .fill(crate::ui::theme::DashColors::surface(dark_mode)) + .fill(DashColors::surface(dark_mode)) .inner_margin(egui::Margin::symmetric(10, 8)) .corner_radius(5.0) .show(ui, |ui| { ui.horizontal(|ui| { ui.label( RichText::new("Estimated Fee:") - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.label( RichText::new(format_credits_as_dash(estimated_fee)) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)) + .color(DashColors::text_primary(dark_mode)) .strong(), ); }); diff --git a/src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs b/src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs index e06a0a97c..abdbba791 100644 --- a/src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs +++ b/src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs @@ -3,6 +3,7 @@ use crate::model::fee_estimation::format_credits_as_dash; use crate::ui::identities::add_new_identity_screen::{ AddNewIdentityScreen, FundingMethod, WalletFundedScreenStep, }; +use crate::ui::theme::DashColors; use egui::{Color32, RichText, Ui}; impl AddNewIdentityScreen { @@ -64,18 +65,18 @@ impl AddNewIdentityScreen { ui.add_space(10.0); let dark_mode = ui.ctx().style().visuals.dark_mode; egui::Frame::new() - .fill(crate::ui::theme::DashColors::surface(dark_mode)) + .fill(DashColors::surface(dark_mode)) .inner_margin(egui::Margin::symmetric(10, 8)) .corner_radius(5.0) .show(ui, |ui| { ui.horizontal(|ui| { ui.label( RichText::new("Estimated Fee:") - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.label( RichText::new(format_credits_as_dash(estimated_fee)) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)) + .color(DashColors::text_primary(dark_mode)) .strong(), ); }); @@ -83,7 +84,7 @@ impl AddNewIdentityScreen { ui.add_space(10.0); let button = egui::Button::new(RichText::new("Create Identity").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::DASH_BLUE) .frame(true) .corner_radius(3.0); if ui.add(button).clicked() { diff --git a/src/ui/identities/add_new_identity_screen/mod.rs b/src/ui/identities/add_new_identity_screen/mod.rs index db7301789..db358b514 100644 --- a/src/ui/identities/add_new_identity_screen/mod.rs +++ b/src/ui/identities/add_new_identity_screen/mod.rs @@ -20,6 +20,7 @@ use crate::ui::components::wallet_unlock_popup::{ WalletUnlockPopup, WalletUnlockResult, try_open_wallet_no_password, wallet_needs_unlock, }; use crate::ui::identities::funding_common::WalletFundedScreenStep; +use crate::ui::theme::DashColors; use crate::ui::{MessageType, ScreenLike}; use dash_sdk::dashcore_rpc::dashcore::Address; use dash_sdk::dashcore_rpc::dashcore::transaction::special_transaction::TransactionPayload; @@ -577,11 +578,7 @@ impl AddNewIdentityScreen { // Use a lighter stripe color that doesn't clash with comboboxes let original_stripe_color = ui.visuals().faint_bg_color; let dark_mode = ui.ctx().style().visuals.dark_mode; - ui.visuals_mut().faint_bg_color = if dark_mode { - Color32::from_rgba_unmultiplied(255, 255, 255, 10) // Very subtle light stripe in dark mode - } else { - Color32::from_rgba_unmultiplied(0, 100, 200, 10) // Light blue tint in light mode - }; + ui.visuals_mut().faint_bg_color = DashColors::stripe(dark_mode); TableBuilder::new(ui) .striped(true) @@ -1070,7 +1067,7 @@ impl ScreenLike for AddNewIdentityScreen { // Display error message at the top, outside of scroll area if let Some(error_message) = self.error_message.clone() { - let message_color = Color32::from_rgb(255, 100, 100); + let message_color = DashColors::ERROR; ui.horizontal(|ui| { egui::Frame::new() @@ -1231,7 +1228,7 @@ impl ScreenLike for AddNewIdentityScreen { let dark_mode = ui.ctx().style().visuals.dark_mode; ui.add( egui::TextEdit::singleline(&mut self.alias_input) - .hint_text(egui::RichText::new("e.g., My Main Identity").color(crate::ui::theme::DashColors::text_secondary(dark_mode))) + .hint_text(egui::RichText::new("e.g., My Main Identity").color(DashColors::text_secondary(dark_mode))) .desired_width(250.0), ); }); @@ -1240,7 +1237,7 @@ impl ScreenLike for AddNewIdentityScreen { ui.label( egui::RichText::new("Note: This is a Dash Evo Tool nickname, not a DPNS username.") .small() - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.add_space(10.0); diff --git a/src/ui/identities/identities_screen.rs b/src/ui/identities/identities_screen.rs index 6d6e07d30..8e063c0d2 100644 --- a/src/ui/identities/identities_screen.rs +++ b/src/ui/identities/identities_screen.rs @@ -397,7 +397,7 @@ impl IdentitiesScreen { RichText::new("No Identities Loaded") .strong() .size(25.0) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)), + .color(DashColors::text_primary(dark_mode)), ); // A separator line for visual clarity @@ -415,7 +415,7 @@ impl IdentitiesScreen { RichText::new("Here’s what you can do:") .strong() .size(18.0) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)), + .color(DashColors::text_primary(dark_mode)), ); ui.add_space(5.0); @@ -614,7 +614,7 @@ impl IdentitiesScreen { let actions_popup_id = ui.make_persistent_id(format!("actions_popup_{}", qualified_identity.identity.id().to_string(Encoding::Base58))); egui::Popup::from_toggle_button_response(&actions_response).id(actions_popup_id) .close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside) - .frame(egui::Frame::popup(ui.style()).fill(if ui.ctx().style().visuals.dark_mode { Color32::from_rgb(40, 40, 40) } else { Color32::WHITE })) + .frame(egui::Frame::popup(ui.style()).fill(DashColors::popup_fill(ui.ctx().style().visuals.dark_mode))) .show(|ui| { ui.set_min_width(150.0); @@ -722,7 +722,7 @@ impl IdentitiesScreen { let popup_id = ui.make_persistent_id(format!("keys_popup_{}", qualified_identity.identity.id().to_string(Encoding::Base58))); egui::Popup::from_toggle_button_response(&button_response).id(popup_id) .close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside) - .frame(egui::Frame::popup(ui.style()).fill(if ui.ctx().style().visuals.dark_mode { Color32::from_rgb(40, 40, 40) } else { Color32::WHITE })) + .frame(egui::Frame::popup(ui.style()).fill(DashColors::popup_fill(ui.ctx().style().visuals.dark_mode))) .show(|ui| { let dark_mode = ui.ctx().style().visuals.dark_mode; @@ -734,7 +734,7 @@ impl IdentitiesScreen { let key_label = self.format_key_name(key); let button = if holding_private_key.is_some() { - egui::Button::new(&key_label).fill(crate::ui::theme::DashColors::selected(dark_mode)) + egui::Button::new(&key_label).fill(DashColors::selected(dark_mode)) } else { egui::Button::new(&key_label) }; @@ -765,7 +765,7 @@ impl IdentitiesScreen { let key_label = self.format_key_name(key); let button = if holding_private_key.is_some() { - egui::Button::new(&key_label).fill(crate::ui::theme::DashColors::selected(dark_mode)) + egui::Button::new(&key_label).fill(DashColors::selected(dark_mode)) } else { egui::Button::new(&key_label) }; @@ -849,11 +849,7 @@ impl IdentitiesScreen { egui::Order::Background, egui::Id::new("confirm_removal_overlay"), )); - painter.rect_filled( - screen_rect, - 0.0, - egui::Color32::from_rgba_unmultiplied(0, 0, 0, 120), - ); + painter.rect_filled(screen_rect, 0.0, DashColors::modal_overlay()); egui::Window::new("Confirm Removal") .collapsible(false) @@ -867,13 +863,10 @@ impl IdentitiesScreen { offset: [0, 8], blur: 16, spread: 0, - color: egui::Color32::from_rgba_unmultiplied(0, 0, 0, 100), + color: DashColors::popup_shadow(), }, fill: ctx.style().visuals.window_fill, - stroke: egui::Stroke::new( - 1.0, - egui::Color32::from_rgba_unmultiplied(255, 255, 255, 30), - ), + stroke: egui::Stroke::new(1.0, DashColors::popup_border_glow()), }) .show(ctx, |ui| { ui.set_min_width(350.0); @@ -925,7 +918,7 @@ impl IdentitiesScreen { // Yes button let yes_button = egui::Button::new(RichText::new("Yes").color(Color32::WHITE)) - .fill(Color32::from_rgb(200, 60, 60)) + .fill(DashColors::DANGER_RED) .corner_radius(egui::CornerRadius::same(4)) .min_size(egui::Vec2::new(80.0, 32.0)); @@ -975,11 +968,7 @@ impl IdentitiesScreen { egui::Order::Background, egui::Id::new("edit_alias_overlay"), )); - painter.rect_filled( - screen_rect, - 0.0, - egui::Color32::from_rgba_unmultiplied(0, 0, 0, 120), - ); + painter.rect_filled(screen_rect, 0.0, DashColors::modal_overlay()); egui::Window::new("Update Alias") .collapsible(false) @@ -993,13 +982,10 @@ impl IdentitiesScreen { offset: [0, 8], blur: 16, spread: 0, - color: egui::Color32::from_rgba_unmultiplied(0, 0, 0, 100), + color: DashColors::popup_shadow(), }, fill: ctx.style().visuals.window_fill, - stroke: egui::Stroke::new( - 1.0, - egui::Color32::from_rgba_unmultiplied(255, 255, 255, 30), - ), + stroke: egui::Stroke::new(1.0, DashColors::popup_border_glow()), }) .show(ctx, |ui| { ui.set_min_width(300.0); diff --git a/src/ui/identities/keys/add_key_screen.rs b/src/ui/identities/keys/add_key_screen.rs index d284f543a..4b048eca2 100644 --- a/src/ui/identities/keys/add_key_screen.rs +++ b/src/ui/identities/keys/add_key_screen.rs @@ -637,7 +637,7 @@ impl ScreenLike for AddKeyScreen { new_style.spacing.button_padding = egui::vec2(10.0, 5.0); ui.set_style(new_style); let button = egui::Button::new(RichText::new("Add Key").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::DASH_BLUE) .frame(true) .corner_radius(3.0); if ui.add(button).clicked() { @@ -683,7 +683,7 @@ impl ScreenLike for AddKeyScreen { ui.label(format!("Adding key... Time taken so far: {}", display_time)); } AddKeyStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/identities/keys/key_info_screen.rs b/src/ui/identities/keys/key_info_screen.rs index 22f9ac7de..1917ab876 100644 --- a/src/ui/identities/keys/key_info_screen.rs +++ b/src/ui/identities/keys/key_info_screen.rs @@ -507,7 +507,7 @@ impl ScreenLike for KeyInfoScreen { // Display error message if validation fails if let Some(error_message) = self.error_message.clone() { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) @@ -707,7 +707,7 @@ impl KeyInfoScreen { } if let Some(error_message) = self.sign_error_message.clone() { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) diff --git a/src/ui/identities/register_dpns_name_screen.rs b/src/ui/identities/register_dpns_name_screen.rs index 6016a8458..6236b47d2 100644 --- a/src/ui/identities/register_dpns_name_screen.rs +++ b/src/ui/identities/register_dpns_name_screen.rs @@ -530,7 +530,7 @@ impl ScreenLike for RegisterDpnsNameScreen { let button = egui::Button::new(RichText::new("Register Name").color(Color32::WHITE)) .fill(if button_enabled { - Color32::from_rgb(0, 128, 255) + DashColors::DASH_BLUE } else { Color32::GRAY }) @@ -589,7 +589,7 @@ impl ScreenLike for RegisterDpnsNameScreen { )); } RegisterDpnsNameStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs b/src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs index f6fc658df..ed562bcfa 100644 --- a/src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs +++ b/src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs @@ -125,7 +125,7 @@ impl TopUpIdentityScreen { new_style.spacing.button_padding = egui::vec2(10.0, 5.0); ui.set_style(new_style); let button = egui::Button::new(RichText::new("Top Up Identity").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::DASH_BLUE) .frame(true) .corner_radius(3.0); if ui.add(button).clicked() { diff --git a/src/ui/identities/top_up_identity_screen/by_using_unused_balance.rs b/src/ui/identities/top_up_identity_screen/by_using_unused_balance.rs index 1bcd0227b..d2242f8b2 100644 --- a/src/ui/identities/top_up_identity_screen/by_using_unused_balance.rs +++ b/src/ui/identities/top_up_identity_screen/by_using_unused_balance.rs @@ -78,7 +78,7 @@ impl TopUpIdentityScreen { new_style.spacing.button_padding = egui::vec2(10.0, 5.0); ui.set_style(new_style); let button = egui::Button::new(RichText::new("Top Up Identity").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::DASH_BLUE) .frame(true) .corner_radius(3.0); if ui.add(button).clicked() { diff --git a/src/ui/identities/top_up_identity_screen/mod.rs b/src/ui/identities/top_up_identity_screen/mod.rs index 7bc8fae6f..0178ac738 100644 --- a/src/ui/identities/top_up_identity_screen/mod.rs +++ b/src/ui/identities/top_up_identity_screen/mod.rs @@ -24,6 +24,7 @@ use crate::ui::components::wallet_unlock_popup::{ }; use crate::ui::identities::add_new_identity_screen::FundingMethod; use crate::ui::identities::funding_common::WalletFundedScreenStep; +use crate::ui::theme::DashColors; use crate::ui::{MessageType, ScreenLike}; use dash_sdk::dashcore_rpc::dashcore::Address; use dash_sdk::dashcore_rpc::dashcore::transaction::special_transaction::TransactionPayload; @@ -530,7 +531,7 @@ impl ScreenLike for TopUpIdentityScreen { // Display error message at the top, outside of scroll area if let Some(error_message) = self.error_message.clone() { - let message_color = egui::Color32::from_rgb(255, 100, 100); + let message_color = DashColors::ERROR; ui.horizontal(|ui| { egui::Frame::new() diff --git a/src/ui/identities/transfer_screen.rs b/src/ui/identities/transfer_screen.rs index 9d4f35ee9..1de8393de 100644 --- a/src/ui/identities/transfer_screen.rs +++ b/src/ui/identities/transfer_screen.rs @@ -178,11 +178,7 @@ impl TransferScreen { // Colors for selected/unselected states let selected_fill = DashColors::DASH_BLUE; let selected_text = Color32::WHITE; - let unselected_fill = if dark_mode { - Color32::from_rgb(60, 60, 60) - } else { - Color32::from_rgb(220, 220, 220) - }; + let unselected_fill = DashColors::unselected_fill(dark_mode); let unselected_text = DashColors::text_primary(dark_mode); ui.horizontal(|ui| { @@ -719,7 +715,7 @@ impl ScreenLike for TransferScreen { new_style.spacing.button_padding = egui::vec2(10.0, 5.0); ui.set_style(new_style); let button = egui::Button::new(RichText::new("Transfer").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::DASH_BLUE) .frame(true) .corner_radius(3.0); @@ -788,7 +784,7 @@ impl ScreenLike for TransferScreen { )); } TransferCreditsStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/identities/withdraw_screen.rs b/src/ui/identities/withdraw_screen.rs index 1ea5aebee..ac5078445 100644 --- a/src/ui/identities/withdraw_screen.rs +++ b/src/ui/identities/withdraw_screen.rs @@ -166,7 +166,7 @@ impl WithdrawalScreen { // Show error next to input if let Some(error) = &self.withdrawal_address_error { - ui.colored_label(Color32::from_rgb(255, 100, 100), error); + ui.colored_label(DashColors::ERROR, error); } }); @@ -548,7 +548,7 @@ impl ScreenLike for WithdrawalScreen { // Withdraw button let button = egui::Button::new(RichText::new("Withdraw").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::DASH_BLUE) .frame(true) .corner_radius(3.0) .min_size(egui::vec2(60.0, 30.0)); @@ -623,7 +623,7 @@ impl ScreenLike for WithdrawalScreen { )); } WithdrawFromIdentityStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/theme.rs b/src/ui/theme.rs index 5b82a028b..b8e7cbc7e 100644 --- a/src/ui/theme.rs +++ b/src/ui/theme.rs @@ -57,6 +57,62 @@ impl DashColors { pub const WARNING: Color32 = Color32::from_rgb(241, 196, 15); pub const ERROR: Color32 = Color32::from_rgb(235, 87, 87); pub const INFO: Color32 = Color32::from_rgb(52, 152, 219); + /// Darker red for danger button hover state + pub const DANGER_HOVER: Color32 = Color32::from_rgb(200, 0, 0); + /// Red for danger/destructive action buttons (delete, remove) + pub const DANGER_RED: Color32 = Color32::from_rgb(200, 60, 60); + /// Gray fill for disabled/inactive buttons + pub const BUTTON_DISABLED: Color32 = Color32::from_rgb(100, 100, 100); + /// Salmon/orange for input validation warnings + pub const VALIDATION_WARNING: Color32 = Color32::from_rgb(255, 150, 100); + /// Bright orange for important warnings (e.g., private key exposure, missing identities) + pub const WARNING_BRIGHT: Color32 = Color32::from_rgb(255, 152, 0); + /// Purple for Platform address type indicators + pub const PLATFORM_PURPLE: Color32 = Color32::from_rgb(130, 80, 220); + /// Blue for primary action buttons (Generate, Save, Import) + pub const ACTION_BUTTON_BLUE: Color32 = Color32::from_rgb(0, 128, 255); + /// Gold/amber for text highlighting (e.g., matched hashes in proof logs) + pub const HIGHLIGHT_GOLD: Color32 = Color32::from_rgb(0x9b, 0x87, 0x0c); + /// Light pink for very weak password strength + pub const STRENGTH_WEAK: Color32 = Color32::from_rgb(255, 182, 193); + /// Light yellow for fair password strength + pub const STRENGTH_FAIR: Color32 = Color32::from_rgb(255, 224, 130); + /// Light green for good password strength + pub const STRENGTH_GOOD: Color32 = Color32::from_rgb(144, 238, 144); + /// Medium green for strong password strength + pub const STRENGTH_STRONG: Color32 = Color32::from_rgb(90, 200, 90); + + // Network accent colors + /// Muted Dash blue for dark mode (20% darker) + pub const DASH_BLUE_DARK: Color32 = Color32::from_rgb(0, 113, 182); + /// Testnet orange for light mode + pub const TESTNET_ORANGE: Color32 = Color32::from_rgb(255, 165, 0); + /// Muted testnet orange for dark mode + pub const TESTNET_ORANGE_DARK: Color32 = Color32::from_rgb(204, 132, 0); + /// Devnet dark red for light mode (matches Color32::DARK_RED) + pub const DEVNET_RED: Color32 = Color32::from_rgb(139, 0, 0); + /// Muted devnet red for dark mode + pub const DEVNET_RED_DARK: Color32 = Color32::from_rgb(111, 0, 0); + /// Regtest brown for light mode + pub const REGTEST_BROWN: Color32 = Color32::from_rgb(139, 69, 19); + /// Muted regtest brown for dark mode + pub const REGTEST_BROWN_DARK: Color32 = Color32::from_rgb(111, 55, 15); + + // Icon tint colors for nav panels + /// Icon tint when selected/active + pub const ICON_SELECTED: Color32 = Color32::WHITE; + /// Cornflower blue tint for selected wallet panel icons + pub const ICON_SELECTED_BLUE: Color32 = Color32::from_rgb(100, 149, 237); + /// Gray tint for unselected icons in dark mode + pub const ICON_UNSELECTED_DARK: Color32 = Color32::from_rgb(180, 180, 180); + /// Gray tint for unselected icons in light mode + pub const ICON_UNSELECTED_LIGHT: Color32 = Color32::from_rgb(160, 160, 160); + /// Gray tint for unselected wallet panel icons + pub const ICON_UNSELECTED: Color32 = Color32::from_rgb(169, 169, 169); + + // Entropy grid colors + /// Off squares in entropy grid (dark mode) + pub const ENTROPY_OFF_DARK: Color32 = Color32::from_rgb(80, 80, 80); // UI Colors - Light mode pub const BACKGROUND: Color32 = Color32::from_rgb(240, 242, 247); @@ -275,6 +331,127 @@ impl DashColors { Color32::GRAY } } + + // Modal/popup overlay colors + + /// Semi-transparent black overlay behind modals/popups + pub fn modal_overlay() -> Color32 { + Color32::from_rgba_unmultiplied(0, 0, 0, 120) + } + + /// Shadow color for popup/dialog frames + pub fn popup_shadow() -> Color32 { + Color32::from_rgba_unmultiplied(0, 0, 0, 100) + } + + /// Subtle border glow for popup/dialog windows + pub fn popup_border_glow() -> Color32 { + Color32::from_rgba_unmultiplied(255, 255, 255, 30) + } + + /// Popup fill color adapting to dark/light mode + pub fn popup_fill(dark_mode: bool) -> Color32 { + if dark_mode { + Self::DARK_INPUT_BACKGROUND // rgb(40, 40, 40) + } else { + Self::WHITE + } + } + + /// Subtle stripe color for alternating table rows in dark mode + pub fn stripe_dark() -> Color32 { + Color32::from_rgba_unmultiplied(255, 255, 255, 10) + } + + /// Subtle stripe color for alternating table rows in light mode + pub fn stripe_light() -> Color32 { + Color32::from_rgba_unmultiplied(0, 100, 200, 10) + } + + /// Stripe color adapting to dark/light mode + pub fn stripe(dark_mode: bool) -> Color32 { + if dark_mode { + Self::stripe_dark() + } else { + Self::stripe_light() + } + } + + /// Fill color for unselected toggle/segmented buttons + pub fn unselected_fill(dark_mode: bool) -> Color32 { + if dark_mode { + Self::DARK_BORDER // rgb(60, 60, 60) + } else { + Color32::from_rgb(220, 220, 220) + } + } + + // Network accent color helpers + + /// Returns the accent color for a given network, adapting to dark/light mode + pub fn network_accent( + network: dash_sdk::dashcore_rpc::dashcore::Network, + dark_mode: bool, + ) -> Color32 { + match network { + dash_sdk::dashcore_rpc::dashcore::Network::Dash => { + if dark_mode { + Self::DASH_BLUE_DARK + } else { + Self::DASH_BLUE + } + } + dash_sdk::dashcore_rpc::dashcore::Network::Testnet => { + if dark_mode { + Self::TESTNET_ORANGE_DARK + } else { + Self::TESTNET_ORANGE + } + } + dash_sdk::dashcore_rpc::dashcore::Network::Devnet => { + if dark_mode { + Self::DEVNET_RED_DARK + } else { + Self::DEVNET_RED + } + } + dash_sdk::dashcore_rpc::dashcore::Network::Regtest => { + if dark_mode { + Self::REGTEST_BROWN_DARK + } else { + Self::REGTEST_BROWN + } + } + _ => { + if dark_mode { + Self::DASH_BLUE_DARK + } else { + Self::DASH_BLUE + } + } + } + } + + /// Returns the network label color (used in left panel, always light-mode tones) + pub fn network_label_color(network: dash_sdk::dashcore_rpc::dashcore::Network) -> Color32 { + match network { + dash_sdk::dashcore_rpc::dashcore::Network::Testnet => Self::TESTNET_ORANGE, + dash_sdk::dashcore_rpc::dashcore::Network::Devnet => Self::DEVNET_RED, + dash_sdk::dashcore_rpc::dashcore::Network::Regtest => Self::REGTEST_BROWN, + _ => Self::DASH_BLUE, + } + } + + /// Icon tint color based on selection state and dark mode + pub fn icon_tint(selected: bool, dark_mode: bool) -> Color32 { + if selected { + Self::ICON_SELECTED + } else if dark_mode { + Self::ICON_UNSELECTED_DARK + } else { + Self::ICON_UNSELECTED_LIGHT + } + } } /// Typography scale and font configuration diff --git a/src/ui/tokens/burn_tokens_screen.rs b/src/ui/tokens/burn_tokens_screen.rs index f4aaf7dcb..950611c62 100644 --- a/src/ui/tokens/burn_tokens_screen.rs +++ b/src/ui/tokens/burn_tokens_screen.rs @@ -597,18 +597,18 @@ impl ScreenLike for BurnTokensScreen { ui.add_space(10.0); let dark_mode = ui.ctx().style().visuals.dark_mode; egui::Frame::new() - .fill(crate::ui::theme::DashColors::surface(dark_mode)) + .fill(DashColors::surface(dark_mode)) .inner_margin(egui::Margin::symmetric(10, 8)) .corner_radius(5.0) .show(ui, |ui| { ui.horizontal(|ui| { ui.label( RichText::new("Estimated Fee:") - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.label( RichText::new(format_credits_as_dash(estimated_fee)) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)) + .color(DashColors::text_primary(dark_mode)) .strong(), ); }); @@ -619,7 +619,7 @@ impl ScreenLike for BurnTokensScreen { ui.add_space(10.0); let button = egui::Button::new(RichText::new(button_text).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .corner_radius(3.0); if ui.add(button).clicked() { diff --git a/src/ui/tokens/claim_tokens_screen.rs b/src/ui/tokens/claim_tokens_screen.rs index 4d95f23d2..8be0c5a70 100644 --- a/src/ui/tokens/claim_tokens_screen.rs +++ b/src/ui/tokens/claim_tokens_screen.rs @@ -572,7 +572,7 @@ impl ScreenLike for ClaimTokensScreen { ui.label(format!("Claiming... elapsed: {}s", elapsed)); } ClaimTokensStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tokens/destroy_frozen_funds_screen.rs b/src/ui/tokens/destroy_frozen_funds_screen.rs index 11d5f8784..e632ab69d 100644 --- a/src/ui/tokens/destroy_frozen_funds_screen.rs +++ b/src/ui/tokens/destroy_frozen_funds_screen.rs @@ -583,7 +583,7 @@ impl ScreenLike for DestroyFrozenFundsScreen { ui.add_space(10.0); let button = egui::Button::new(RichText::new(button_text).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .corner_radius(3.0); if ui.add(button).clicked() { diff --git a/src/ui/tokens/direct_token_purchase_screen.rs b/src/ui/tokens/direct_token_purchase_screen.rs index 997dc7c76..3f715ea52 100644 --- a/src/ui/tokens/direct_token_purchase_screen.rs +++ b/src/ui/tokens/direct_token_purchase_screen.rs @@ -549,18 +549,18 @@ impl ScreenLike for PurchaseTokenScreen { let estimated_fee = self.app_context.fee_estimator().estimate_token_transition(); let dark_mode = ui.ctx().style().visuals.dark_mode; egui::Frame::new() - .fill(crate::ui::theme::DashColors::surface(dark_mode)) + .fill(DashColors::surface(dark_mode)) .inner_margin(egui::Margin::symmetric(10, 8)) .corner_radius(5.0) .show(ui, |ui| { ui.horizontal(|ui| { ui.label( RichText::new("Estimated Fee:") - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.label( RichText::new(format_credits_as_dash(estimated_fee)) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)) + .color(DashColors::text_primary(dark_mode)) .strong(), ); }); @@ -581,7 +581,7 @@ impl ScreenLike for PurchaseTokenScreen { if can_purchase { let button = egui::Button::new(RichText::new(purchase_text).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .corner_radius(3.0); if ui.add(button).clicked() && self.confirmation_dialog.is_none() { diff --git a/src/ui/tokens/freeze_tokens_screen.rs b/src/ui/tokens/freeze_tokens_screen.rs index 35ac3d6e4..7bf40e67b 100644 --- a/src/ui/tokens/freeze_tokens_screen.rs +++ b/src/ui/tokens/freeze_tokens_screen.rs @@ -568,18 +568,18 @@ impl ScreenLike for FreezeTokensScreen { ui.add_space(10.0); let dark_mode = ui.ctx().style().visuals.dark_mode; egui::Frame::new() - .fill(crate::ui::theme::DashColors::surface(dark_mode)) + .fill(DashColors::surface(dark_mode)) .inner_margin(egui::Margin::symmetric(10, 8)) .corner_radius(5.0) .show(ui, |ui| { ui.horizontal(|ui| { ui.label( RichText::new("Estimated Fee:") - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.label( RichText::new(format_credits_as_dash(estimated_fee)) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)) + .color(DashColors::text_primary(dark_mode)) .strong(), ); }); @@ -590,7 +590,7 @@ impl ScreenLike for FreezeTokensScreen { ui.add_space(10.0); let button = egui::Button::new(RichText::new(button_text).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .corner_radius(3.0); if ui.add(button).clicked() { @@ -619,7 +619,7 @@ impl ScreenLike for FreezeTokensScreen { ui.label(format!("Freezing... elapsed: {}s", elapsed)); } FreezeTokensStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tokens/mint_tokens_screen.rs b/src/ui/tokens/mint_tokens_screen.rs index 0244d6797..6a77fe0c0 100644 --- a/src/ui/tokens/mint_tokens_screen.rs +++ b/src/ui/tokens/mint_tokens_screen.rs @@ -646,18 +646,18 @@ impl ScreenLike for MintTokensScreen { ui.add_space(10.0); let dark_mode = ui.ctx().style().visuals.dark_mode; egui::Frame::new() - .fill(crate::ui::theme::DashColors::surface(dark_mode)) + .fill(DashColors::surface(dark_mode)) .inner_margin(egui::Margin::symmetric(10, 8)) .corner_radius(5.0) .show(ui, |ui| { ui.horizontal(|ui| { ui.label( RichText::new("Estimated Fee:") - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.label( RichText::new(format_credits_as_dash(estimated_fee)) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)) + .color(DashColors::text_primary(dark_mode)) .strong(), ); }); @@ -668,7 +668,7 @@ impl ScreenLike for MintTokensScreen { ui.add_space(10.0); let button = egui::Button::new(RichText::new(button_text).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .corner_radius(3.0); if ui.add(button).clicked() { diff --git a/src/ui/tokens/pause_tokens_screen.rs b/src/ui/tokens/pause_tokens_screen.rs index c6624398c..809c6f080 100644 --- a/src/ui/tokens/pause_tokens_screen.rs +++ b/src/ui/tokens/pause_tokens_screen.rs @@ -495,7 +495,7 @@ impl ScreenLike for PauseTokensScreen { ui.add_space(10.0); let button = egui::Button::new(RichText::new(button_text).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .corner_radius(3.0); if ui.add(button).clicked() && self.confirmation_dialog.is_none() { @@ -524,7 +524,7 @@ impl ScreenLike for PauseTokensScreen { ui.label(format!("Pausing... elapsed: {}s", elapsed)); } PauseTokensStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tokens/resume_tokens_screen.rs b/src/ui/tokens/resume_tokens_screen.rs index 7e20dac1e..3f20f299d 100644 --- a/src/ui/tokens/resume_tokens_screen.rs +++ b/src/ui/tokens/resume_tokens_screen.rs @@ -496,7 +496,7 @@ impl ScreenLike for ResumeTokensScreen { ui.add_space(10.0); let button = egui::Button::new(RichText::new(button_text).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .corner_radius(3.0); if ui.add(button).clicked() && self.confirmation_dialog.is_none() { @@ -524,7 +524,7 @@ impl ScreenLike for ResumeTokensScreen { ui.label(format!("Resuming... elapsed: {}s", elapsed)); } ResumeTokensStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tokens/set_token_price_screen.rs b/src/ui/tokens/set_token_price_screen.rs index 2e026ea99..813d9c50f 100644 --- a/src/ui/tokens/set_token_price_screen.rs +++ b/src/ui/tokens/set_token_price_screen.rs @@ -1112,9 +1112,9 @@ impl ScreenLike for SetTokenPriceScreen { let button_active = validation_result.is_ok() && !matches!(self.status, SetTokenPriceStatus::WaitingForResult(_)); let button_color = if validation_result.is_ok() { - Color32::from_rgb(0, 128, 255) + DashColors::ACTION_BUTTON_BLUE } else { - Color32::from_rgb(100, 100, 100) + DashColors::BUTTON_DISABLED }; let button = egui::Button::new(RichText::new(set_price_text).color(Color32::WHITE)) @@ -1149,7 +1149,7 @@ impl ScreenLike for SetTokenPriceScreen { ui.label(format!("Setting price... elapsed: {} seconds", elapsed)); } SetTokenPriceStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tokens/tokens_screen/keyword_search.rs b/src/ui/tokens/tokens_screen/keyword_search.rs index 04edb2876..1879675f1 100644 --- a/src/ui/tokens/tokens_screen/keyword_search.rs +++ b/src/ui/tokens/tokens_screen/keyword_search.rs @@ -9,7 +9,6 @@ use crate::ui::tokens::tokens_screen::{ use chrono::Utc; use dash_sdk::dpp::platform_value::string_encoding::Encoding; use eframe::emath::Align; -use eframe::epaint::Color32; use egui::{Frame, Margin, RichText, Ui}; use egui_extras::{Column, TableBuilder}; @@ -140,7 +139,7 @@ impl TokensScreen { } } ContractSearchStatus::ErrorMessage(e) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::error_color(ui.visuals().dark_mode); let msg = e.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tokens/tokens_screen/mod.rs b/src/ui/tokens/tokens_screen/mod.rs index 37b3442a1..b9d097e9c 100644 --- a/src/ui/tokens/tokens_screen/mod.rs +++ b/src/ui/tokens/tokens_screen/mod.rs @@ -254,7 +254,7 @@ impl ChangeControlRulesUI { egui::Button::new( RichText::new(button_text) .size(20.0) - .color(crate::ui::theme::DashColors::DASH_BLUE), + .color(DashColors::DASH_BLUE), ) .fill(Color32::TRANSPARENT) .stroke(egui::Stroke::NONE), @@ -334,8 +334,8 @@ impl ChangeControlRulesUI { [300.0, 22.0], TextEdit::singleline(id_str) .hint_text("Enter base58 id") - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)), + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)), ); if !id_str.is_empty() { @@ -417,8 +417,8 @@ impl ChangeControlRulesUI { [300.0, 22.0], TextEdit::singleline(id_str) .hint_text("Enter base58 id") - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)), + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)), ); if !id_str.is_empty() { @@ -503,7 +503,7 @@ impl ChangeControlRulesUI { egui::Button::new( RichText::new(button_text) .size(20.0) - .color(crate::ui::theme::DashColors::DASH_BLUE), + .color(DashColors::DASH_BLUE), ) .fill(Color32::TRANSPARENT) .stroke(egui::Stroke::NONE), @@ -583,8 +583,8 @@ impl ChangeControlRulesUI { [300.0, 22.0], TextEdit::singleline(id_str) .hint_text("Enter base58 id") - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)), + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)), ); if !id_str.is_empty() { @@ -666,8 +666,8 @@ impl ChangeControlRulesUI { [300.0, 22.0], TextEdit::singleline(id_str) .hint_text("Enter base58 id") - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)), + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)), ); if !id_str.is_empty() { diff --git a/src/ui/tokens/tokens_screen/my_tokens.rs b/src/ui/tokens/tokens_screen/my_tokens.rs index 09f294c01..a97dfdc47 100644 --- a/src/ui/tokens/tokens_screen/my_tokens.rs +++ b/src/ui/tokens/tokens_screen/my_tokens.rs @@ -852,7 +852,7 @@ impl TokensScreen { if is_loading { // Show loading spinner - ui.add(egui::Spinner::new().color(crate::ui::theme::DashColors::DASH_BLUE)); + ui.add(egui::Spinner::new().color(DashColors::DASH_BLUE)); } else if has_pricing_data { // Check if identity has enough credits for at least one token let has_credits = self diff --git a/src/ui/tokens/tokens_screen/token_creator.rs b/src/ui/tokens/tokens_screen/token_creator.rs index 3b4dc2fc8..208d70a35 100644 --- a/src/ui/tokens/tokens_screen/token_creator.rs +++ b/src/ui/tokens/tokens_screen/token_creator.rs @@ -971,7 +971,7 @@ impl TokensScreen { // Show an error if we have one if let Some(err_msg) = self.token_creator_error_message.clone() { ui.add_space(10.0); - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) @@ -1574,7 +1574,7 @@ impl TokensScreen { ui.add(egui::Hyperlink::from_label_and_url( RichText::new("dashpay.io") .underline() - .color(Color32::from_rgb(0, 128, 255)), + .color(DashColors::ACTION_BUTTON_BLUE), "https://dashpay.io", )); }); @@ -1585,8 +1585,8 @@ impl TokensScreen { let schemas_response = ui.add_sized( [ui.available_width(), 120.0], TextEdit::multiline(&mut self.document_schemas_input) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)), + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)), ); if schemas_response.changed() { diff --git a/src/ui/tokens/transfer_tokens_screen.rs b/src/ui/tokens/transfer_tokens_screen.rs index 8fffe040b..ac04bb8f3 100644 --- a/src/ui/tokens/transfer_tokens_screen.rs +++ b/src/ui/tokens/transfer_tokens_screen.rs @@ -490,7 +490,7 @@ impl ScreenLike for TransferTokensScreen { new_style.spacing.button_padding = egui::vec2(10.0, 5.0); ui.set_style(new_style); let button = egui::Button::new(RichText::new("Transfer").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); let hover_text = if !has_enough_balance { diff --git a/src/ui/tokens/unfreeze_tokens_screen.rs b/src/ui/tokens/unfreeze_tokens_screen.rs index a0b97f777..93d81fdcb 100644 --- a/src/ui/tokens/unfreeze_tokens_screen.rs +++ b/src/ui/tokens/unfreeze_tokens_screen.rs @@ -571,7 +571,7 @@ impl ScreenLike for UnfreezeTokensScreen { ui.add_space(10.0); let button = egui::Button::new(RichText::new(button_text).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .corner_radius(3.0); if ui.add(button).clicked() { @@ -608,7 +608,7 @@ impl ScreenLike for UnfreezeTokensScreen { ui.label(format!("Unfreezing... elapsed: {}s", elapsed)); } UnfreezeTokensStatus::ErrorMessage(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tokens/update_token_config.rs b/src/ui/tokens/update_token_config.rs index 2aff65d1c..82ea57b3f 100644 --- a/src/ui/tokens/update_token_config.rs +++ b/src/ui/tokens/update_token_config.rs @@ -17,6 +17,7 @@ use crate::ui::helpers::{TransactionType, add_key_chooser, render_group_action_t use crate::ui::identities::get_selected_wallet; use crate::ui::identities::keys::add_key_screen::AddKeyScreen; use crate::ui::identities::keys::key_info_screen::KeyInfoScreen; +use crate::ui::theme::DashColors; use crate::ui::{MessageType, Screen, ScreenLike}; use chrono::{DateTime, Utc}; use dash_sdk::dpp::data_contract::GroupContractPosition; @@ -715,18 +716,18 @@ impl UpdateTokenConfigScreen { ui.add_space(10.0); let dark_mode = ui.ctx().style().visuals.dark_mode; egui::Frame::new() - .fill(crate::ui::theme::DashColors::surface(dark_mode)) + .fill(DashColors::surface(dark_mode)) .inner_margin(egui::Margin::symmetric(10, 8)) .corner_radius(5.0) .show(ui, |ui| { ui.horizontal(|ui| { ui.label( RichText::new("Estimated Fee:") - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.label( RichText::new(format_credits_as_dash(estimated_fee)) - .color(crate::ui::theme::DashColors::text_primary(dark_mode)) + .color(DashColors::text_primary(dark_mode)) .strong(), ); }); @@ -741,7 +742,7 @@ impl UpdateTokenConfigScreen { ); let button = egui::Button::new(RichText::new(&button_text).color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); @@ -858,10 +859,8 @@ impl UpdateTokenConfigScreen { [300.0, 22.0], egui::TextEdit::singleline(id_str) .hint_text("Enter base58 identity") - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background( - dark_mode, - )), + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)), ); if !id_str.is_empty() { @@ -1103,7 +1102,8 @@ impl ScreenLike for UpdateTokenConfigScreen { ui.colored_label(Color32::DARK_GREEN, &msg); } MessageType::Error => { - let error_color = Color32::from_rgb(255, 100, 100); + let dark_mode = ui.ctx().style().visuals.dark_mode; + let error_color = DashColors::error_color(dark_mode); Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) diff --git a/src/ui/tokens/view_token_claims_screen.rs b/src/ui/tokens/view_token_claims_screen.rs index 1dc3e975b..cc9635c68 100644 --- a/src/ui/tokens/view_token_claims_screen.rs +++ b/src/ui/tokens/view_token_claims_screen.rs @@ -136,7 +136,7 @@ impl ScreenLike for ViewTokenClaimsScreen { let fetch_button = egui::Button::new(RichText::new("Fetch claims").color(Color32::WHITE)) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); diff --git a/src/ui/tools/address_balance_screen.rs b/src/ui/tools/address_balance_screen.rs index 1f8a75b7c..42aef74af 100644 --- a/src/ui/tools/address_balance_screen.rs +++ b/src/ui/tools/address_balance_screen.rs @@ -6,8 +6,9 @@ use crate::ui::components::left_panel::add_left_panel; use crate::ui::components::styled::island_central_panel; use crate::ui::components::tools_subscreen_chooser_panel::add_tools_subscreen_chooser_panel; use crate::ui::components::top_panel::add_top_panel; +use crate::ui::theme::DashColors; use crate::ui::{MessageType, ScreenLike}; -use eframe::egui::{self, Color32, Context, Frame, Margin, RichText, ScrollArea, TextEdit, Ui}; +use eframe::egui::{self, Context, Frame, Margin, RichText, ScrollArea, TextEdit, Ui}; use std::sync::Arc; pub struct AddressBalanceScreen { @@ -93,7 +94,7 @@ impl AddressBalanceScreen { fn render_result(&mut self, ui: &mut Ui) { if let Some(ref error) = self.error_message { ui.add_space(20.0); - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let error = error.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tools/contract_visualizer_screen.rs b/src/ui/tools/contract_visualizer_screen.rs index e810214e1..816b5242c 100644 --- a/src/ui/tools/contract_visualizer_screen.rs +++ b/src/ui/tools/contract_visualizer_screen.rs @@ -5,6 +5,7 @@ use crate::ui::components::left_panel::add_left_panel; use crate::ui::components::styled::island_central_panel; use crate::ui::components::tools_subscreen_chooser_panel::add_tools_subscreen_chooser_panel; use crate::ui::components::top_panel::add_top_panel; +use crate::ui::theme::DashColors; use base64::{Engine, engine::general_purpose::STANDARD}; use dash_sdk::dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; use dash_sdk::platform::DataContract; @@ -125,8 +126,8 @@ impl ContractVisualizerScreen { TextEdit::multiline(&mut self.input_data_hex) .desired_rows(4) .desired_width(ui.available_width()) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .code_editor(), ); if resp.changed() { @@ -144,7 +145,7 @@ impl ContractVisualizerScreen { ui.monospace(self.parsed_json.as_ref().unwrap()); } ContractParseStatus::Error(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tools/document_visualizer_screen.rs b/src/ui/tools/document_visualizer_screen.rs index 00fd2aebc..0997f74ae 100644 --- a/src/ui/tools/document_visualizer_screen.rs +++ b/src/ui/tools/document_visualizer_screen.rs @@ -7,6 +7,7 @@ use crate::ui::components::styled::island_central_panel; use crate::ui::components::tools_subscreen_chooser_panel::add_tools_subscreen_chooser_panel; use crate::ui::components::top_panel::add_top_panel; use crate::ui::helpers::add_contract_doc_type_chooser_with_filtering; +use crate::ui::theme::DashColors; use base64::{Engine, engine::general_purpose::STANDARD}; use dash_sdk::dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; @@ -144,8 +145,8 @@ impl DocumentVisualizerScreen { TextEdit::multiline(&mut self.input_data_hex) .desired_rows(4) .desired_width(ui.available_width()) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .code_editor(), ); if resp.changed() { @@ -166,7 +167,7 @@ impl DocumentVisualizerScreen { ui.colored_label(Color32::GRAY, "Select a contract and document type."); } DocumentParseStatus::Error(msg) => { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::error_color(ui.visuals().dark_mode); let msg = msg.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tools/grovestark_screen.rs b/src/ui/tools/grovestark_screen.rs index 5ad4c70fa..e835a9db7 100644 --- a/src/ui/tools/grovestark_screen.rs +++ b/src/ui/tools/grovestark_screen.rs @@ -806,7 +806,7 @@ impl GroveSTARKScreen { // Error Display if let Some(error) = &self.gen_error_message { - let error_color = egui::Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let error = error.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) @@ -886,7 +886,7 @@ impl GroveSTARKScreen { // Error Display (above the button) if let Some(error) = &self.verify_error_message { - let error_color = egui::Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let error = error.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tools/masternode_list_diff_screen.rs b/src/ui/tools/masternode_list_diff_screen.rs index cd8d12a71..8697d4552 100644 --- a/src/ui/tools/masternode_list_diff_screen.rs +++ b/src/ui/tools/masternode_list_diff_screen.rs @@ -1564,8 +1564,8 @@ impl MasternodeListDiffScreen { let dark_mode = ui.ctx().style().visuals.dark_mode; let message_color = match msg_type { - MessageType::Error => Color32::from_rgb(255, 100, 100), - MessageType::Info => crate::ui::theme::DashColors::text_primary(dark_mode), + MessageType::Error => DashColors::ERROR, + MessageType::Info => DashColors::text_primary(dark_mode), // Dark green for success text MessageType::Success => Color32::DARK_GREEN, }; @@ -1593,7 +1593,7 @@ impl MasternodeListDiffScreen { return; }; - let message_color = Color32::from_rgb(255, 100, 100); + let message_color = DashColors::ERROR; ui.horizontal(|ui| { Frame::new() .fill(message_color.gamma_multiply(0.1)) @@ -1623,12 +1623,9 @@ impl MasternodeListDiffScreen { ui.scope(|ui| { let style = ui.style_mut(); // Force spinner (fg stroke) to Dash Blue - style.visuals.widgets.inactive.fg_stroke.color = - crate::ui::theme::DashColors::DASH_BLUE; - style.visuals.widgets.active.fg_stroke.color = - crate::ui::theme::DashColors::DASH_BLUE; - style.visuals.widgets.hovered.fg_stroke.color = - crate::ui::theme::DashColors::DASH_BLUE; + style.visuals.widgets.inactive.fg_stroke.color = DashColors::DASH_BLUE; + style.visuals.widgets.active.fg_stroke.color = DashColors::DASH_BLUE; + style.visuals.widgets.hovered.fg_stroke.color = DashColors::DASH_BLUE; ui.add(egui::Spinner::new()); }); let label = match pending { diff --git a/src/ui/tools/platform_info_screen.rs b/src/ui/tools/platform_info_screen.rs index bf0b30e7f..d85be3359 100644 --- a/src/ui/tools/platform_info_screen.rs +++ b/src/ui/tools/platform_info_screen.rs @@ -6,11 +6,11 @@ use crate::ui::components::left_panel::add_left_panel; use crate::ui::components::styled::island_central_panel; use crate::ui::components::tools_subscreen_chooser_panel::add_tools_subscreen_chooser_panel; use crate::ui::components::top_panel::add_top_panel; +use crate::ui::theme::DashColors; use crate::ui::{MessageType, RootScreenType, ScreenLike}; use dash_sdk::dpp::dashcore::Network; use dash_sdk::dpp::version::PlatformVersion; use eframe::egui::{self, Context, Frame, Margin, RichText, ScrollArea, Ui}; -use egui::Color32; use std::sync::Arc; pub struct PlatformInfoScreen { @@ -115,10 +115,7 @@ impl PlatformInfoScreen { ui.add_space(50.0); // Show spinner with Dash blue color - ui.add( - egui::widgets::Spinner::default() - .color(crate::ui::theme::DashColors::DASH_BLUE), - ); + ui.add(egui::widgets::Spinner::default().color(DashColors::DASH_BLUE)); ui.add_space(10.0); ui.heading("Loading..."); @@ -129,7 +126,7 @@ impl PlatformInfoScreen { // Check for errors and display them in the results area if let Some(error) = &self.error_message { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; let error = error.clone(); Frame::new() .fill(error_color.gamma_multiply(0.1)) diff --git a/src/ui/tools/proof_log_screen.rs b/src/ui/tools/proof_log_screen.rs index 05130dfc1..5e165a3e5 100644 --- a/src/ui/tools/proof_log_screen.rs +++ b/src/ui/tools/proof_log_screen.rs @@ -250,7 +250,7 @@ impl ProofLogScreen { 0.0, TextFormat { font_id: font_id.clone(), - color: Color32::from_rgb(0x9b, 0x87, 0x0c), // Highlight color + color: DashColors::HIGHLIGHT_GOLD, // Highlight color ..Default::default() }, ); diff --git a/src/ui/tools/proof_visualizer_screen.rs b/src/ui/tools/proof_visualizer_screen.rs index 852df2f1c..39fe65fb7 100644 --- a/src/ui/tools/proof_visualizer_screen.rs +++ b/src/ui/tools/proof_visualizer_screen.rs @@ -4,6 +4,7 @@ use crate::ui::components::left_panel::add_left_panel; use crate::ui::components::styled::island_central_panel; use crate::ui::components::tools_subscreen_chooser_panel::add_tools_subscreen_chooser_panel; use crate::ui::components::top_panel::add_top_panel; +use crate::ui::theme::DashColors; use crate::ui::{MessageType, RootScreenType, ScreenLike}; use base64::{Engine, engine::general_purpose::STANDARD}; @@ -83,8 +84,8 @@ impl ProofVisualizerScreen { TextEdit::multiline(&mut self.input_data) .desired_rows(6) .desired_width(ui.available_width()) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .code_editor(), ); @@ -110,8 +111,8 @@ impl ProofVisualizerScreen { TextEdit::multiline(&mut json.clone()) .desired_rows(10) .desired_width(ui.available_width()) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .font(egui::TextStyle::Monospace), ); @@ -123,8 +124,8 @@ impl ProofVisualizerScreen { TextEdit::multiline(&mut error.clone()) .desired_rows(10) .desired_width(ui.available_width()) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .font(egui::TextStyle::Monospace), ); diff --git a/src/ui/tools/transition_visualizer_screen.rs b/src/ui/tools/transition_visualizer_screen.rs index a05f39a1e..8faa82106 100644 --- a/src/ui/tools/transition_visualizer_screen.rs +++ b/src/ui/tools/transition_visualizer_screen.rs @@ -6,6 +6,7 @@ use crate::ui::components::left_panel::add_left_panel; use crate::ui::components::styled::island_central_panel; use crate::ui::components::tools_subscreen_chooser_panel::add_tools_subscreen_chooser_panel; use crate::ui::components::top_panel::add_top_panel; +use crate::ui::theme::DashColors; use crate::ui::{MessageType, RootScreenType, ScreenLike}; use base64::{Engine, engine::general_purpose::STANDARD}; @@ -155,8 +156,8 @@ impl TransitionVisualizerScreen { TextEdit::multiline(&mut self.input_data) .desired_rows(6) .desired_width(ui.available_width()) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .code_editor(), ); @@ -209,8 +210,8 @@ impl TransitionVisualizerScreen { TextEdit::multiline(&mut json.clone()) .desired_rows(10) .desired_width(ui.available_width()) - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .font(egui::TextStyle::Monospace), ); @@ -228,7 +229,7 @@ impl TransitionVisualizerScreen { let button = egui::Button::new( RichText::new("Broadcast Transition to Platform").color(Color32::WHITE), ) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); diff --git a/src/ui/wallets/add_new_wallet_screen.rs b/src/ui/wallets/add_new_wallet_screen.rs index 0ce55ccbe..f25a320d6 100644 --- a/src/ui/wallets/add_new_wallet_screen.rs +++ b/src/ui/wallets/add_new_wallet_screen.rs @@ -380,16 +380,16 @@ impl AddNewWalletScreen { RichText::new("Recommended Next Steps:") .size(16.0) .strong() - .color(crate::ui::theme::DashColors::text_primary(dark_mode)), + .color(DashColors::text_primary(dark_mode)), ); ui.add_space(12.0); // Step 1: Fund wallet ui.horizontal(|ui| { let step_color = if self.funds_received { - crate::ui::theme::DashColors::success_color(dark_mode) + DashColors::success_color(dark_mode) } else { - crate::ui::theme::DashColors::text_secondary(dark_mode) + DashColors::text_secondary(dark_mode) }; ui.label( RichText::new("1.") @@ -416,12 +416,12 @@ impl AddNewWalletScreen { RichText::new("2.") .size(14.0) .strong() - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); ui.label( RichText::new("Create a Platform Identity to register a username and interact with apps") .size(14.0) - .color(crate::ui::theme::DashColors::text_secondary(dark_mode)), + .color(DashColors::text_secondary(dark_mode)), ); }); }, @@ -473,11 +473,7 @@ impl AddNewWalletScreen { egui::Order::Background, egui::Id::new("receive_funds_overlay"), )); - painter.rect_filled( - screen_rect, - 0.0, - egui::Color32::from_rgba_unmultiplied(0, 0, 0, 120), - ); + painter.rect_filled(screen_rect, 0.0, DashColors::modal_overlay()); // Generate QR code if needed let mut qr_error: Option = None; @@ -638,7 +634,7 @@ impl AddNewWalletScreen { .color(Color32::WHITE), ) .min_size(Vec2::new(100.0, 20.0)) - .fill(Color32::from_rgb(0, 128, 255)) // Blue background + .fill(DashColors::ACTION_BUTTON_BLUE) // Blue background .corner_radius(5.0); if ui.add(generate_button).clicked() { @@ -832,10 +828,10 @@ impl ScreenLike for AddNewWalletScreen { // Since score ranges from 0 to 4, adjust percentage accordingly let strength_percentage = (self.password_strength / 100.0).min(1.0); let fill_color = match self.password_strength as i32 { - 0..=25 => Color32::from_rgb(255, 182, 193), // Light pink - 26..=50 => Color32::from_rgb(255, 224, 130), // Light yellow - 51..=75 => Color32::from_rgb(144, 238, 144), // Light green - _ => Color32::from_rgb(90, 200, 90), // Medium green + 0..=25 => DashColors::STRENGTH_WEAK, + 26..=50 => DashColors::STRENGTH_FAIR, + 51..=75 => DashColors::STRENGTH_GOOD, + _ => DashColors::STRENGTH_STRONG, }; ui.add( egui::ProgressBar::new(strength_percentage as f32) @@ -872,7 +868,7 @@ impl ScreenLike for AddNewWalletScreen { let save_button = egui::Button::new( RichText::new("Save Wallet").color(Color32::WHITE), ) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); diff --git a/src/ui/wallets/asset_lock_detail_screen.rs b/src/ui/wallets/asset_lock_detail_screen.rs index e52ead8b0..28bcf528b 100644 --- a/src/ui/wallets/asset_lock_detail_screen.rs +++ b/src/ui/wallets/asset_lock_detail_screen.rs @@ -393,11 +393,7 @@ impl ScreenLike for AssetLockDetailScreen { egui::Order::Background, egui::Id::new("private_key_popup_overlay"), )); - painter.rect_filled( - screen_rect, - 0.0, - egui::Color32::from_rgba_unmultiplied(0, 0, 0, 120), - ); + painter.rect_filled(screen_rect, 0.0, DashColors::modal_overlay()); egui::Window::new("Private Key") .collapsible(false) @@ -407,7 +403,7 @@ impl ScreenLike for AssetLockDetailScreen { ui.set_min_width(400.0); ui.add_space(10.0); - ui.label(RichText::new("⚠ Warning").color(Color32::from_rgb(255, 152, 0)).strong()); + ui.label(RichText::new("⚠ Warning").color(DashColors::WARNING_BRIGHT).strong()); ui.label("Keep this private key secure! Anyone with access to it can spend these funds."); ui.add_space(15.0); diff --git a/src/ui/wallets/create_asset_lock_screen.rs b/src/ui/wallets/create_asset_lock_screen.rs index eea9978b7..c4456404a 100644 --- a/src/ui/wallets/create_asset_lock_screen.rs +++ b/src/ui/wallets/create_asset_lock_screen.rs @@ -445,7 +445,7 @@ impl ScreenLike for CreateAssetLockScreen { if identities.is_empty() { ui.label( RichText::new("No identities found. Please create an identity first.") - .color(egui::Color32::from_rgb(255, 152, 0)) + .color(DashColors::WARNING_BRIGHT) ); return; } diff --git a/src/ui/wallets/import_mnemonic_screen.rs b/src/ui/wallets/import_mnemonic_screen.rs index 2749dfe41..85247628a 100644 --- a/src/ui/wallets/import_mnemonic_screen.rs +++ b/src/ui/wallets/import_mnemonic_screen.rs @@ -11,6 +11,7 @@ use eframe::egui::Context; use crate::model::wallet::encryption::{DASH_SECRET_MESSAGE, encrypt_message}; use crate::model::wallet::{ClosedKeyItem, OpenWalletSeed, Wallet, WalletSeed}; +use crate::ui::theme::DashColors; use crate::ui::wallets::add_new_wallet_screen::{ DASH_BIP44_ACCOUNT_0_PATH_MAINNET, DASH_BIP44_ACCOUNT_0_PATH_TESTNET, }; @@ -398,12 +399,8 @@ impl ImportMnemonicScreen { let response = ui.add_sized( Vec2::new(input_width, 20.0), egui::TextEdit::singleline(&mut word) - .text_color(crate::ui::theme::DashColors::text_primary( - dark_mode, - )) - .background_color( - crate::ui::theme::DashColors::input_background(dark_mode), - ), + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)), ); if response.changed() { @@ -451,8 +448,8 @@ impl ImportMnemonicScreen { Vec2::new(ui.available_width() - 20.0, 40.0), egui::TextEdit::singleline(&mut self.private_key_input) .hint_text("Enter private key (WIF: 51-52 chars, or hex: 64 chars)") - .text_color(crate::ui::theme::DashColors::text_primary(dark_mode)) - .background_color(crate::ui::theme::DashColors::input_background(dark_mode)) + .text_color(DashColors::text_primary(dark_mode)) + .background_color(DashColors::input_background(dark_mode)) .password(true), ); @@ -468,7 +465,7 @@ impl ImportMnemonicScreen { ui.label( RichText::new(wallet.address.to_string()) .monospace() - .color(Color32::from_rgb(100, 200, 100)), + .color(DashColors::SUCCESS), ); }); } @@ -476,7 +473,7 @@ impl ImportMnemonicScreen { // Show error if any if let Some(ref err) = self.error { ui.add_space(5.0); - ui.colored_label(Color32::from_rgb(255, 100, 100), err); + ui.colored_label(DashColors::ERROR, err); } } @@ -606,7 +603,7 @@ impl ScreenLike for ImportMnemonicScreen { if let Some(ref error_msg) = self.error && error_msg.contains("Invalid seed phrase") { ui.add_space(10.0); - ui.colored_label(Color32::from_rgb(255, 100, 100), error_msg); + ui.colored_label(DashColors::ERROR, error_msg); } if self.seed_phrase.is_none() { @@ -677,10 +674,10 @@ impl ScreenLike for ImportMnemonicScreen { // Since score ranges from 0 to 4, adjust percentage accordingly let strength_percentage = (self.password_strength / 100.0).min(1.0); let fill_color = match self.password_strength as i32 { - 0..=25 => Color32::from_rgb(255, 182, 193), // Light pink - 26..=50 => Color32::from_rgb(255, 224, 130), // Light yellow - 51..=75 => Color32::from_rgb(144, 238, 144), // Light green - _ => Color32::from_rgb(90, 200, 90), // Medium green + 0..=25 => DashColors::STRENGTH_WEAK, + 26..=50 => DashColors::STRENGTH_FAIR, + 51..=75 => DashColors::STRENGTH_GOOD, + _ => DashColors::STRENGTH_STRONG, }; ui.add( egui::ProgressBar::new(strength_percentage as f32) @@ -733,7 +730,7 @@ impl ScreenLike for ImportMnemonicScreen { let save_button = egui::Button::new( RichText::new(button_label).color(Color32::WHITE), ) - .fill(Color32::from_rgb(0, 128, 255)) + .fill(DashColors::ACTION_BUTTON_BLUE) .frame(true) .corner_radius(3.0); diff --git a/src/ui/wallets/send_screen.rs b/src/ui/wallets/send_screen.rs index 622b62a2b..75938e4a3 100644 --- a/src/ui/wallets/send_screen.rs +++ b/src/ui/wallets/send_screen.rs @@ -1143,16 +1143,13 @@ impl WalletSendScreen { let mut dismiss = false; ui.horizontal(|ui| { Frame::new() - .fill(Color32::from_rgb(255, 100, 100).gamma_multiply(0.1)) + .fill(DashColors::ERROR.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) .corner_radius(5.0) - .stroke(egui::Stroke::new(1.0, Color32::from_rgb(255, 100, 100))) + .stroke(egui::Stroke::new(1.0, DashColors::ERROR)) .show(ui, |ui| { ui.horizontal(|ui| { - ui.label( - RichText::new(&error_msg) - .color(Color32::from_rgb(255, 100, 100)), - ); + ui.label(RichText::new(&error_msg).color(DashColors::ERROR)); ui.add_space(10.0); if ui.small_button("Dismiss").clicked() { dismiss = true; @@ -1374,7 +1371,7 @@ impl WalletSendScreen { ui.add_space(10.0); let (type_text, type_color) = match dest_type { AddressType::Core => ("Core Address", DashColors::DASH_BLUE), - AddressType::Platform => ("Platform Address", Color32::from_rgb(130, 80, 220)), + AddressType::Platform => ("Platform Address", DashColors::PLATFORM_PURPLE), AddressType::Unknown => ("", Color32::GRAY), }; ui.label( @@ -2182,7 +2179,7 @@ impl WalletSendScreen { let (type_text, type_color) = match addr_type { AddressType::Core => ("Core", DashColors::DASH_BLUE), AddressType::Platform => { - ("Platform", Color32::from_rgb(130, 80, 220)) + ("Platform", DashColors::PLATFORM_PURPLE) } AddressType::Unknown => ("", Color32::GRAY), }; diff --git a/src/ui/wallets/single_key_send_screen.rs b/src/ui/wallets/single_key_send_screen.rs index d00931560..e7c759c45 100644 --- a/src/ui/wallets/single_key_send_screen.rs +++ b/src/ui/wallets/single_key_send_screen.rs @@ -885,7 +885,7 @@ impl ScreenLike for SingleKeyWalletSendScreen { if let Some((message, message_type, _)) = &self.message { let message = message.clone(); let message_color = match message_type { - MessageType::Error => Color32::from_rgb(255, 100, 100), + MessageType::Error => DashColors::ERROR, MessageType::Info => DashColors::text_primary(dark_mode), MessageType::Success => Color32::DARK_GREEN, }; diff --git a/src/ui/wallets/wallets_screen/dialogs.rs b/src/ui/wallets/wallets_screen/dialogs.rs index 23a71f366..4bb64a208 100644 --- a/src/ui/wallets/wallets_screen/dialogs.rs +++ b/src/ui/wallets/wallets_screen/dialogs.rs @@ -16,7 +16,7 @@ use dash_sdk::dpp::key_wallet::bip32::DerivationPath; use eframe::egui::{self, ComboBox, Context}; use eframe::epaint::TextureHandle; use egui::load::SizedTexture; -use egui::{Color32, Frame, Margin, RichText, TextureOptions}; +use egui::{Frame, Margin, RichText, TextureOptions}; use std::sync::{Arc, RwLock}; use super::WalletsBalancesScreen; @@ -102,11 +102,7 @@ impl WalletsBalancesScreen { egui::Order::Background, egui::Id::new(id), )); - painter.rect_filled( - screen_rect, - 0.0, - egui::Color32::from_rgba_unmultiplied(0, 0, 0, 120), - ); + painter.rect_filled(screen_rect, 0.0, DashColors::modal_overlay()); } pub(super) fn modal_frame(ctx: &Context) -> Frame { @@ -118,13 +114,10 @@ impl WalletsBalancesScreen { offset: [0, 8], blur: 16, spread: 0, - color: egui::Color32::from_rgba_unmultiplied(0, 0, 0, 100), + color: DashColors::popup_shadow(), }, fill: ctx.style().visuals.window_fill, - stroke: egui::Stroke::new( - 1.0, - egui::Color32::from_rgba_unmultiplied(255, 255, 255, 30), - ), + stroke: egui::Stroke::new(1.0, DashColors::popup_border_glow()), } } @@ -165,7 +158,7 @@ impl WalletsBalancesScreen { ui.add(egui::TextEdit::singleline(&mut self.send_dialog.memo)); if let Some(error) = self.send_dialog.error.clone() { - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8)) @@ -703,7 +696,7 @@ impl WalletsBalancesScreen { // Status message if let Some(status) = &self.fund_platform_dialog.status { let status_color = if self.fund_platform_dialog.status_is_error { - egui::Color32::from_rgb(220, 50, 50) + DashColors::DANGER_RED } else { DashColors::text_secondary(dark_mode) }; diff --git a/src/ui/wallets/wallets_screen/mod.rs b/src/ui/wallets/wallets_screen/mod.rs index 4af4817ff..fa9550ebb 100644 --- a/src/ui/wallets/wallets_screen/mod.rs +++ b/src/ui/wallets/wallets_screen/mod.rs @@ -1371,7 +1371,7 @@ impl ScreenLike for WalletsBalancesScreen { let message = self.message.clone(); if let Some((message, message_type, _timestamp)) = message { let message_color = match message_type { - MessageType::Error => egui::Color32::from_rgb(255, 100, 100), + MessageType::Error => DashColors::ERROR, MessageType::Info => DashColors::text_primary(dark_mode), MessageType::Success => egui::Color32::DARK_GREEN, }; @@ -1664,7 +1664,7 @@ impl ScreenLike for WalletsBalancesScreen { // Display error message if the password was incorrect if let Some(error_message) = self.sk_error_message.clone() { ui.add_space(5.0); - let error_color = Color32::from_rgb(255, 100, 100); + let error_color = DashColors::ERROR; Frame::new() .fill(error_color.gamma_multiply(0.1)) .inner_margin(Margin::symmetric(10, 8))