diff --git a/src/ui/window/about.rs b/src/ui/window/about.rs index 388f0e295..a9e4fc809 100644 --- a/src/ui/window/about.rs +++ b/src/ui/window/about.rs @@ -1,14 +1,9 @@ use crate::app::Message; use crate::t; +use crate::ui::style::common::muted_style; use iced::widget::{button, column, container, row, svg, text, Space}; use iced::{Background, Border, Element, Fill, Length, Shrink, Theme}; -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), diff --git a/src/ui/window/alias_editor.rs b/src/ui/window/alias_editor.rs index 3e0bdb277..66835b7a7 100644 --- a/src/ui/window/alias_editor.rs +++ b/src/ui/window/alias_editor.rs @@ -7,6 +7,7 @@ //! unsaved-changes guard on close. use crate::app::Message; +use crate::ui::style::common::muted_style; use iced::widget::{button, column, container, row, scrollable, text, text_input, Space}; use iced::{Background, Element, Length, Theme}; use crate::t; @@ -21,12 +22,6 @@ pub enum AliasField { /// Right-hand lane reserved for the scrollbar so it never overlaps the ✕ column. const GUTTER: f32 = 16.0; -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 danger_text_style(theme: &Theme) -> iced::widget::text::Style { iced::widget::text::Style { color: Some(theme.palette().danger.base.color), diff --git a/src/ui/window/attribute_editor.rs b/src/ui/window/attribute_editor.rs index 2f43d9f59..0128ce1b2 100644 --- a/src/ui/window/attribute_editor.rs +++ b/src/ui/window/attribute_editor.rs @@ -25,6 +25,7 @@ use std::borrow::Cow; use std::fmt; use crate::ui::properties::{lw_options, LwItem}; +use crate::ui::style::common::muted_style; use crate::ui::style::form::hdivider; const LABEL_W: f32 = 120.0; @@ -140,12 +141,6 @@ pub fn color_from_label(label: &str) -> Option { }) } -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 field_style(theme: &Theme, status: text_input::Status) -> text_input::Style { let palette = theme.palette(); let border = match status { diff --git a/src/ui/window/layers.rs b/src/ui/window/layers.rs index f25b08eac..bf2ee1d9f 100644 --- a/src/ui/window/layers.rs +++ b/src/ui/window/layers.rs @@ -2,6 +2,7 @@ use crate::app::Message; use crate::ui::properties::{lw_options, LinetypeItem, LwItem}; +use crate::ui::style::common::muted_style; use crate::ui::ROW_H; use acadrust::tables::layer::Layer as DocLayer; use acadrust::tables::Table; @@ -51,12 +52,6 @@ const LINETYPE_MENU_W: f32 = 220.0; /// scrolled into view after it is added (#271). pub const LAYER_TABLE_SCROLL_ID: &str = "layer-manager-table-scroll"; -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 table_input_style( theme: &Theme, status: iced::widget::text_input::Status, diff --git a/src/ui/window/layout_manager.rs b/src/ui/window/layout_manager.rs index 1f30938fb..9d0132cec 100644 --- a/src/ui/window/layout_manager.rs +++ b/src/ui/window/layout_manager.rs @@ -1,17 +1,12 @@ //! Layout Manager window — fills the entire OS window. use crate::app::Message; +use crate::ui::style::common::muted_style; use crate::ui::style::form::{hdivider, vsep}; use iced::widget::{button, column, container, row, scrollable, text, text_input, Space}; use iced::{Background, Element, Theme}; use crate::t; -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), diff --git a/src/ui/window/named_parameters.rs b/src/ui/window/named_parameters.rs index 88afb3bf8..9148cac98 100644 --- a/src/ui/window/named_parameters.rs +++ b/src/ui/window/named_parameters.rs @@ -17,6 +17,7 @@ use crate::app::Message; use crate::scene::named_parameters::ParameterTable; use crate::scene::Scene; use crate::t; +use crate::ui::style::common::muted_style; use acadrust::types::Handle; use acadrust::EntityType; use iced::widget::tooltip::Position as TipPos; @@ -113,12 +114,6 @@ pub struct ParamEditorRow { /// column — same convention and value as `alias_editor::GUTTER`. const GUTTER: f32 = 16.0; -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 danger_style(theme: &Theme) -> iced::widget::text::Style { iced::widget::text::Style { color: Some(theme.palette().danger.base.color), diff --git a/src/ui/window/plugin_manager.rs b/src/ui/window/plugin_manager.rs index 341fc09a6..a6c2637fa 100644 --- a/src/ui/window/plugin_manager.rs +++ b/src/ui/window/plugin_manager.rs @@ -8,6 +8,7 @@ use crate::app::Message; use crate::plugin::external::{ExternalPlugin, RegistryEntry, ReleaseInfo}; +use crate::ui::style::common::muted_style; use iced::widget::{ button, column, container, markdown, row, rule, scrollable, text, text_input, Space, }; @@ -48,12 +49,6 @@ inventory::submit!(crate::command::CommandRegistration { names: &["PLUGINS", "PLUGINMANAGER"] }); -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), diff --git a/src/ui/window/print_all.rs b/src/ui/window/print_all.rs index 05b5f5265..c95f39619 100644 --- a/src/ui/window/print_all.rs +++ b/src/ui/window/print_all.rs @@ -1,5 +1,6 @@ use crate::app::Message; use crate::t; +use crate::ui::style::common::muted_style as muted; use iced::widget::{button, checkbox, column, container, row, scrollable, text, Space}; use iced::{Background, Border, Element, Length, Theme}; @@ -13,12 +14,6 @@ fn button_style(primary: bool) -> impl Fn(&Theme, button::Status) -> button::Sty } } -fn muted(theme: &Theme) -> iced::widget::text::Style { - iced::widget::text::Style { - color: Some(theme.palette().background.base.text.scale_alpha(0.68)), - } -} - pub fn view_window<'a>( layouts: &'a [(String, bool)], printer: Option<&'a str>, diff --git a/src/ui/window/recovery.rs b/src/ui/window/recovery.rs index 0ae3ed5f3..8bfa1d8da 100644 --- a/src/ui/window/recovery.rs +++ b/src/ui/window/recovery.rs @@ -1,14 +1,9 @@ use crate::app::Message; use crate::io::recovery::{RecoveryReport, RecoveryStatus}; +use crate::ui::style::common::muted_style; use iced::widget::{button, column, container, row, scrollable, text, Space}; use iced::{Background, Border, Element, Fill, Length, Shrink, Theme}; -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 status_style( status: RecoveryStatus, ) -> impl Fn(&Theme) -> iced::widget::text::Style + Copy { diff --git a/src/ui/window/shortcuts.rs b/src/ui/window/shortcuts.rs index 63440fa33..50e3b098d 100644 --- a/src/ui/window/shortcuts.rs +++ b/src/ui/window/shortcuts.rs @@ -2,6 +2,7 @@ use crate::app::Message; use crate::t; +use crate::ui::style::common::muted_style; use iced::widget::{button, column, container, row, scrollable, text, text_input, Space}; use iced::{Background, Element, Length, Theme}; @@ -13,12 +14,6 @@ pub enum ShortcutField { const GUTTER: f32 = 16.0; -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 danger_text_style(theme: &Theme) -> iced::widget::text::Style { iced::widget::text::Style { color: Some(theme.palette().danger.base.color), diff --git a/src/ui/window/update_notice.rs b/src/ui/window/update_notice.rs index 2aa020118..2ac897d32 100644 --- a/src/ui/window/update_notice.rs +++ b/src/ui/window/update_notice.rs @@ -1,15 +1,10 @@ use crate::app::Message; +use crate::ui::style::common::muted_style; use iced::widget::{button, column, container, row, scrollable, text, Space}; use iced::{Background, Border, Element, Theme}; use crate::t; use std::borrow::Cow; -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), diff --git a/src/ui/window/xref_help.rs b/src/ui/window/xref_help.rs index 39ec474e9..09e07490c 100644 --- a/src/ui/window/xref_help.rs +++ b/src/ui/window/xref_help.rs @@ -5,6 +5,7 @@ //! unreadable sliver. use crate::app::Message; +use crate::ui::style::common::muted_style; use iced::widget::{button, column, container, row, text, Space}; use iced::{Background, Element, Fill, Length, Theme}; @@ -12,12 +13,6 @@ use iced::{Background, Element, Fill, Length, Theme}; /// missing or broken behavior where it will be seen. pub const XREF_ISSUES_URL: &str = "https://github.com/HakanSeven12/OpenCADStudio/issues"; -fn muted_style(theme: &Theme) -> iced::widget::text::Style { - iced::widget::text::Style { - color: Some(theme.palette().background.base.text.scale_alpha(0.68)), - } -} - pub fn view_window(sizing: crate::ui::modal::ModalSizing) -> Element<'static, Message> { // Fixed window width: paragraphs wrap against this instead of the // toolbar, which is what made the dropdown unreadable. diff --git a/src/ui/window/xref_manager.rs b/src/ui/window/xref_manager.rs index 7ea68ed8b..e3edf4148 100644 --- a/src/ui/window/xref_manager.rs +++ b/src/ui/window/xref_manager.rs @@ -9,6 +9,7 @@ use crate::app::Message; use crate::io::xref::collect_entries_with_prev; use crate::io::xref_model::{normalize_lexical, Pathtype, RefKind, RefStatus, RefType, ReferenceEntry}; use crate::ui::ROW_H; +use crate::ui::style::common::muted_style; use acadrust::CadDocument; use iced::widget::{button, column, container, mouse_area, row, scrollable, text, tooltip}; use iced::Padding; @@ -1286,12 +1287,6 @@ fn format_date(modified: Option) -> String { // ── Widget helpers (layers.rs conventions) ──────────────────────────────── -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 row_button_style(selected: bool, index: usize) -> impl Fn(&Theme, button::Status) -> button::Style { move |theme: &Theme, status: button::Status| { let palette = theme.palette();