ui: current wallet item background

This commit is contained in:
ardocrat 2024-06-04 16:48:44 +03:00
parent 2a48c493b7
commit 951886f5c7
2 changed files with 4 additions and 15 deletions

View file

@ -72,9 +72,6 @@ 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(48);
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 {
AppConfig::dark_theme().unwrap_or(false)
@ -238,12 +235,4 @@ impl Colors {
ITEM_HOVER
}
}
pub fn item_current() -> Color32 {
if use_dark() {
ITEM_CURRENT_DARK
} else {
ITEM_CURRENT
}
}
}

View file

@ -376,12 +376,12 @@ impl WalletsContent {
let mut rect = ui.available_rect_before_wrap();
rect.set_height(78.0);
let rounding = View::item_rounding(0, 1, false);
let bg = if current {
Colors::item_current()
let (bg, stroke) = if current {
(Colors::fill_deep(), View::item_stroke())
} else {
Colors::fill()
(Colors::fill(), View::hover_stroke())
};
ui.painter().rect(rect, rounding, bg, View::hover_stroke());
ui.painter().rect(rect, rounding, bg, stroke);
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
// Setup padding for item buttons.