feat(ui): add configurable Iced themes

This commit is contained in:
Hakan Seven committed 2026-07-28 09:33:12 +03:00
1 parent 73545520c8
commit 4bf14baea4
52 files changed
+3063 -5670

No files matched your search

+6 -47
View File
@@ -1,7 +1,7 @@
//! Annotation / viewport scale status menu.
use iced::widget::{button, row, text};
use iced::{Background, Color, Element, Fill, Theme};
use iced::{Element, Fill};
use crate::app::Message;
use crate::ui::statusbar::status_menu::Entry;
@@ -44,66 +44,25 @@ pub fn menu_entries(
}
fn scale_row(label: String, active: bool, msg: Message) -> Element<'static, Message> {
let check = crate::ui::icons::check_cell(active, CHECK_COLOR);
let check = crate::ui::icons::themed_check_cell(active);
let lbl = text(label)
.size(11)
.color(if active { LABEL_ON } else { LABEL_OFF });
let lbl = text(label).size(11);
let content = row![check, lbl].spacing(6).align_y(iced::Center);
button(content)
.on_press(msg)
.style(|_: &Theme, status| button::Style {
background: Some(Background::Color(match status {
button::Status::Hovered => ROW_HOVER,
_ => Color::TRANSPARENT,
})),
..Default::default()
})
.style(button::subtle)
.width(Fill)
.padding([4, 10])
.into()
}
fn manage_row() -> Element<'static, Message> {
button(text("Manage...").size(11).color(CHECK_COLOR))
button(text("Manage...").size(11))
.on_press(Message::ScaleManagerOpen)
.style(|_: &Theme, status| button::Style {
background: Some(Background::Color(match status {
button::Status::Hovered => ROW_HOVER,
_ => Color::TRANSPARENT,
})),
..Default::default()
})
.style(button::primary)
.width(Fill)
.padding([5, 10])
.into()
}
// ── Colours ───────────────────────────────────────────────────────────────
const ROW_HOVER: Color = Color {
r: 0.22,
g: 0.22,
b: 0.22,
a: 1.0,
};
const CHECK_COLOR: Color = Color {
r: 0.35,
g: 0.75,
b: 1.00,
a: 1.0,
};
const LABEL_ON: Color = Color {
r: 0.92,
g: 0.92,
b: 0.92,
a: 1.0,
};
const LABEL_OFF: Color = Color {
r: 0.65,
g: 0.65,
b: 0.65,
a: 1.0,
};