forked from 1b-agent/opencadstudio-upstream
feat(ui): add configurable Iced themes
This commit is contained in:
1 parent
73545520c8
commit
4bf14baea4
52 files changed
+3063
-5670
No files matched your search
@@ -1,7 +1,7 @@
|
||||
//! Polar-tracking angle status menu.
|
||||
|
||||
use iced::widget::{button, container, row, text, text_input};
|
||||
use iced::{Background, Color, Element, Fill, Length, Theme};
|
||||
use iced::{Element, Fill, Length};
|
||||
|
||||
use crate::app::Message;
|
||||
use crate::ui::statusbar::status_menu::Entry;
|
||||
@@ -41,7 +41,7 @@ pub fn menu_entries<'a>(
|
||||
let custom_row = container(
|
||||
row![
|
||||
custom_field,
|
||||
text("°").size(11).color(LABEL_OFF),
|
||||
text("°").size(11),
|
||||
]
|
||||
.spacing(4)
|
||||
.align_y(iced::Center),
|
||||
@@ -52,51 +52,16 @@ pub fn menu_entries<'a>(
|
||||
}
|
||||
|
||||
fn angle_row<'a>(deg: f32, active: bool) -> Element<'a, Message> {
|
||||
let check = crate::ui::icons::check_cell(active, CHECK_COLOR);
|
||||
let check = crate::ui::icons::themed_check_cell(active);
|
||||
|
||||
let lbl = text(angle_label(deg))
|
||||
.size(11)
|
||||
.color(if active { LABEL_ON } else { LABEL_OFF });
|
||||
let lbl = text(angle_label(deg)).size(11);
|
||||
|
||||
let content = row![check, lbl].spacing(6).align_y(iced::Center);
|
||||
|
||||
button(content)
|
||||
.on_press(Message::SetPolarAngle(deg))
|
||||
.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()
|
||||
}
|
||||
|
||||
// ── 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,
|
||||
};
|
||||
Reference in new issue
Block a user