Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/ui/components/confirmation_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/ui/components/entropy_grid.rs
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
}
};

Expand Down
13 changes: 3 additions & 10 deletions src/ui/components/info_popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
16 changes: 5 additions & 11 deletions src/ui/components/left_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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),
};
Expand Down
7 changes: 4 additions & 3 deletions src/ui/components/left_wallet_panel.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -86,9 +87,9 @@ pub fn add_left_panel(
let texture: Option<TextureHandle> = 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
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/styled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl StyledButton {
ButtonVariant::Danger => (
DashColors::WHITE,
DashColors::ERROR,
Color32::from_rgb(200, 0, 0),
DashColors::DANGER_HOVER,
None,
),
ButtonVariant::Ghost => (
Expand Down
67 changes: 14 additions & 53 deletions src/ui/components/top_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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)
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 4 additions & 6 deletions src/ui/components/wallet_unlock.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down
15 changes: 4 additions & 11 deletions src/ui/components/wallet_unlock_popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions src/ui/contracts_documents/add_contracts_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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() {
Expand Down
Loading
Loading