ui: fix dark colors, panels strokes

This commit is contained in:
ardocrat 2024-05-30 12:02:52 +03:00
parent c5bafffa76
commit e099b5da8e
8 changed files with 30 additions and 31 deletions

View file

@ -34,9 +34,9 @@ const GREEN: Color32 = Color32::from_rgb(0, 0x64, 0);
const RED: Color32 = Color32::from_rgb(0x8B, 0, 0);
const FILL: Color32 = Color32::from_gray(244);
const FILL_DEEP: Color32 = Color32::from_gray(238);
const FILL_DARK: Color32 = Color32::from_gray(24);
const FILL_DEEP: Color32 = Color32::from_gray(238);
const FILL_DEEP_DARK: Color32 = Color32::from_gray(18);
const TEXT: Color32 = Color32::from_gray(80);
@ -58,7 +58,7 @@ const GRAY: Color32 = Color32::from_gray(120);
const GRAY_DARK: Color32 = Color32::from_gray(145);
const STROKE: Color32 = Color32::from_gray(200);
const STROKE_DARK: Color32 = Color32::from_gray(65);
const STROKE_DARK: Color32 = Color32::from_gray(50);
const INACTIVE_TEXT: Color32 = Color32::from_gray(150);
const INACTIVE_TEXT_DARK: Color32 = Color32::from_gray(115);
@ -67,13 +67,13 @@ const ITEM_BUTTON: Color32 = Color32::from_gray(90);
const ITEM_BUTTON_DARK: Color32 = Color32::from_gray(175);
const ITEM_STROKE: Color32 = Color32::from_gray(220);
const ITEM_STROKE_DARK: Color32 = Color32::from_gray(45);
const ITEM_STROKE_DARK: Color32 = Color32::from_gray(40);
const ITEM_HOVER: Color32 = Color32::from_gray(205);
const ITEM_HOVER_DARK: Color32 = Color32::from_gray(60);
const ITEM_HOVER_DARK: Color32 = Color32::from_gray(48);
const ITEM_CURRENT: Color32 = Color32::from_gray(227);
const ITEM_CURRENT_DARK: Color32 = Color32::from_gray(38);
const ITEM_CURRENT: Color32 = Color32::from_gray(233);
const ITEM_CURRENT_DARK: Color32 = Color32::from_gray(34);
/// Check if dark theme should be used.
fn use_dark() -> bool {

View file

@ -43,7 +43,7 @@ pub struct Modal {
impl Modal {
/// Margin from [`Modal`] window at top/left/right.
const DEFAULT_MARGIN: f32 = 6.0;
const DEFAULT_MARGIN: f32 = 8.0;
/// Maximum width of the content.
const DEFAULT_WIDTH: f32 = Root::SIDE_PANEL_WIDTH - (2.0 * Self::DEFAULT_MARGIN);
@ -288,12 +288,12 @@ impl Modal {
// Draw title content.
let title_resp = ui.allocate_ui_at_rect(rect, |ui| {
ui.vertical_centered_justified(|ui| {
ui.add_space(10.0);
ui.add_space(9.0);
ui.label(RichText::new(self.title.as_ref().unwrap())
.size(19.0)
.color(Colors::title(true))
);
ui.add_space(10.0);
ui.add_space(8.0);
});
}).response;

View file

@ -55,7 +55,6 @@ impl NetworkContent {
.resizable(false)
.frame(egui::Frame {
fill: Colors::fill(),
stroke: View::item_stroke(),
inner_margin: Margin {
left: View::get_left_inset() + 4.0,
right: View::far_right_inset_margin(ui) + 4.0,
@ -78,14 +77,13 @@ impl NetworkContent {
.resizable(false)
.exact_width(ui.available_width())
.frame(egui::Frame {
stroke: View::default_stroke(),
..Default::default()
})
.show_animated_inside(ui, !show_connections, |ui| {
egui::CentralPanel::default()
.frame(egui::Frame {
fill: Colors::white_or_black(false),
stroke: View::default_stroke(),
stroke: View::item_stroke(),
inner_margin: Margin {
left: View::get_left_inset() + 4.0,
right: View::far_right_inset_margin(ui) + 4.0,
@ -104,9 +102,13 @@ impl NetworkContent {
egui::CentralPanel::default()
.frame(egui::Frame {
stroke: if show_connections{
if Root::is_dual_panel_mode(ui) {
View::default_stroke()
} else {
Stroke::NONE
}
} else {
Stroke::NONE
},
inner_margin: Margin {
left: if show_connections {

View file

@ -118,7 +118,7 @@ impl WalletsContent {
Colors::fill_deep()
} else {
if create_wallet {
Colors::white_or_black(true)
Colors::white_or_black(false)
} else {
Colors::button()
}
@ -175,7 +175,6 @@ impl WalletsContent {
// Show wallets bottom panel.
egui::TopBottomPanel::bottom("wallets_bottom_panel")
.frame(egui::Frame {
stroke: View::item_stroke(),
fill: Colors::fill(),
inner_margin: Margin {
left: View::get_left_inset() + 4.0,
@ -197,9 +196,7 @@ impl WalletsContent {
});
});
// Show non-empty list if wallet is not creating and list not hidden.
if !list_hidden {
// Show wallet list panel.
egui::CentralPanel::default()
.frame(egui::Frame {
stroke: View::default_stroke(),
@ -353,6 +350,9 @@ impl WalletsContent {
let mut list = self.wallets.list().clone();
// Remove deleted wallet from the list.
list.retain(|w| !w.is_deleted());
if !dual_panel {
ui.add_space(1.0);
}
for wallet in &list {
// Check if wallet reopen is needed.
if !wallet.is_open() && wallet.reopen_needed() {
@ -384,11 +384,7 @@ impl WalletsContent {
rect.set_height(78.0);
let rounding = View::item_rounding(0, 1, false);
let bg = if current {
if AppConfig::dark_theme().unwrap_or(false) {
egui::Color32::from_gray(32)
} else {
egui::Color32::from_gray(233)
}
Colors::item_current()
} else {
Colors::fill()
};

View file

@ -99,8 +99,7 @@ impl WalletCreation {
// Show wallet creation step content panel.
egui::CentralPanel::default()
.frame(egui::Frame {
fill: Colors::fill(),
stroke: View::default_stroke(),
stroke: View::item_stroke(),
inner_margin: Margin {
left: View::far_left_inset_margin(ui) + 4.0,
right: View::get_right_inset() + 4.0,

View file

@ -91,7 +91,7 @@ impl WalletContent {
egui::TopBottomPanel::top(Id::from("wallet_balance").with(wallet.identifier()))
.frame(egui::Frame {
fill: Colors::fill(),
stroke: View::default_stroke(),
stroke: View::item_stroke(),
inner_margin: Margin {
left: View::far_left_inset_margin(ui) + 4.0,
right: View::get_right_inset() + 4.0,
@ -102,7 +102,11 @@ impl WalletContent {
left: 0.0,
right: 0.0,
top: 0.0,
bottom: -1.0,
bottom: if !Root::is_dual_panel_mode(ui) {
0.0
} else {
-1.0
},
},
..Default::default()
})
@ -118,7 +122,6 @@ impl WalletContent {
// Show wallet tabs panel.
egui::TopBottomPanel::bottom("wallet_tabs")
.frame(egui::Frame {
stroke: View::item_stroke(),
fill: Colors::fill(),
inner_margin: Margin {
left: View::far_left_inset_margin(ui) + 4.0,
@ -141,7 +144,6 @@ impl WalletContent {
egui::CentralPanel::default()
.frame(egui::Frame {
fill: Colors::white_or_black(false),
stroke: View::default_stroke(),
..Default::default()
})
.show_inside(ui, |ui| {

View file

@ -64,7 +64,7 @@ impl WalletTab for WalletSettings {
// Show settings content panel.
egui::CentralPanel::default()
.frame(egui::Frame {
stroke: View::default_stroke(),
stroke: View::item_stroke(),
fill: Colors::white_or_black(false),
inner_margin: Margin {
left: View::far_left_inset_margin(ui) + 4.0,

View file

@ -216,7 +216,7 @@ impl WalletTransactions {
.scroll_bar_visibility(ScrollBarVisibility::AlwaysHidden)
.auto_shrink([false; 2])
.show_rows(ui, TX_ITEM_HEIGHT, data.txs.len(), |ui, row_range| {
ui.add_space(3.0);
ui.add_space(1.0);
View::max_width_ui(ui, Root::SIDE_PANEL_WIDTH * 1.3, |ui| {
let padding = amount_conf != 0 || amount_fin != 0 || amount_locked != 0;
for index in row_range {