forked from 1b-agent/opencadstudio-upstream
refactor(style): dedup muted_style into ui::style::common
Centralize the 7 byte-identical `muted_style` helpers (alpha 0.68) previously duplicated across src/ui/style/* into a single `src/ui/style/common.rs::muted_style` (+ alias `muted_text_style`). All 7 style windows and the style_manager wrapper now call the common helper, ensuring a theme palette change updates one place. `btn_s` is intentionally NOT deduped: plotstyle.rs:41 and style_manager.rs:299 have divergent bodies (Disabled handling + text alpha 0.45). Unifying would silently change plotstyle disabled appearance : documented in common.rs and covered by test. TDD: RED `common_tests` failed E0433 (missing common), GREEN added common.rs and wired `pub mod common`, REFACTOR replaced locals with `use crate::ui::style::common::muted_style`. Tests: - common_muted_style_matches_local_copy: asserts common output equals 0.68 alpha reference - common_muted_text_style_alias_matches: alias identity - btn_s_bodies_documented_as_divergent: documents intentional non-dedup
This commit is contained in:
1 parent
199a484fcb
commit
bdedcf63fc
10 files changed
+71
-45
No files matched your search
@@ -4,6 +4,7 @@ use crate::app::{Message, StyleKind};
|
||||
use crate::t;
|
||||
use iced::widget::{button, canvas, checkbox, column, container, row, scrollable, text, text_input};
|
||||
use iced::{mouse, Background, Border, Element, Length, Point, Rectangle, Theme};
|
||||
use crate::ui::style::common::muted_style;
|
||||
use std::borrow::Cow;
|
||||
|
||||
pub struct TextStyleView<'a> {
|
||||
@@ -36,12 +37,6 @@ const BUILTIN_FONTS: &[&str] = &[
|
||||
"Symbol", "ISO3098", "Unicode",
|
||||
];
|
||||
|
||||
fn muted_style(theme: &Theme) -> iced::widget::text::Style {
|
||||
iced::widget::text::Style {
|
||||
color: Some(theme.palette().background.base.text.scale_alpha(0.68)),
|
||||
}
|
||||
}
|
||||
|
||||
fn primary_style(theme: &Theme) -> iced::widget::text::Style {
|
||||
iced::widget::text::Style {
|
||||
color: Some(theme.palette().primary.base.color),
|
||||
|
||||
Reference in new issue
Block a user