Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

UI: integrate theme radii, borders, palettes and viewport refresh (#5045) (#5046)

Nathan Danefb374b543ba8
diff --git a/assets/icons/ui/STYLE_GUIDE.md b/assets/icons/ui/STYLE_GUIDE.md
index 33c91585af..d40c53c855 100644
--- a/assets/icons/ui/STYLE_GUIDE.md
+++ b/assets/icons/ui/STYLE_GUIDE.md
@@ -78,7 +78,7 @@ Its projected circle uses the same axes; do not arbitrarily flatten the ellipse.
Only use the stable `source` identifiers below in model SVGs. The renderer maps roles to
light/dark theme values. `currentColor` is the background line-art role, not a way
-to add arbitrary colours. All values and accents come from `design/palette.toml`.
+to add arbitrary colours. Default display values and semantic accents come from `design/palette.toml`. Theme files may override those display roles and ramps through `icon_palette`; source identifiers and accent assignments stay unchanged.
| Role | Author helper | Light value | Use |
| --- | --- | --- | --- |
@@ -96,9 +96,9 @@ The source hexes identify paint roles, not the displayed colour. **Never recolou
SVG to apply a workspace accent.** Keep these identifiers and every finished shape
unchanged; the runtime and review page resolve them through `design/palette.toml`.
-That file is the single colour authority: edit `light`/`dark` in the relevant
+That file is the default colour authority: edit `light`/`dark` in the relevant
`accents` ramp; `active-3` is its primary stroke and `active-1/2` are shaded faces.
-Do not edit a role's `source` identifier. `variants` holds colour-vision adjustments.
+Do not edit a role's `source` identifier. Theme `icon_palette` overrides affect display colours only; colour-vision variants still take precedence. `variants` holds colour-vision adjustments.
A role with `use = "active-3"` follows that stroke automatically.
| Meaning | Accent | Assignment |
diff --git a/assets/styles/ui/palettes.rs b/assets/styles/ui/palettes.rs
index 8c17f893d1..9be2093203 100644
--- a/assets/styles/ui/palettes.rs
+++ b/assets/styles/ui/palettes.rs
@@ -8,6 +8,8 @@ const fn icon_primary(rgb: [u8; 3]) -> Color32 {
impl Tokens {
pub const fn light() -> Tokens {
Tokens {
+ borders: crate::theme::Borders::LEGACY,
+ icon_palette: None,
file_dim: Color32::from_rgb(58, 70, 86),
file_recovery_well: Color32::from_rgb(247, 226, 184),
file_action_height: 32.0,
diff --git a/assets/styles/ui/themes/amber-phosphor.json b/assets/styles/ui/themes/amber-phosphor.json
index cd998a058a..22dba6d227 100644
--- a/assets/styles/ui/themes/amber-phosphor.json
+++ b/assets/styles/ui/themes/amber-phosphor.json
@@ -30,7 +30,7 @@
"box_crossing": "#d4902f",
"box_window": "#ffad38",
"chip": "#4a3210",
- "construction_geom": "#ad7626",
+ "construction_geom": "#dd9a2f",
"construction_plane": "#c6872c18",
"continuity": [
"#c5862b",
@@ -54,25 +54,25 @@
"dimension_driven": "#9b6922",
"error": "#fff0ca",
"field": "#100b04",
- "form_accent": "#d6922f",
+ "form_accent": "#ca892b",
"form_dim": "#9b6922",
"form_error": "#fff0ca",
"form_error_fill": "#46300f",
- "form_fill": "#7e561c",
+ "form_fill": "#e19e45",
"form_ink": "#f3ca87",
"form_primary": "#ffad38",
- "form_soft": "#291c09",
+ "form_soft": "#271b09",
"form_success": "#d4902f",
"form_success_fill": "#3b280d",
- "form_tab_ink": "#f0a335",
+ "form_tab_ink": "#cf8d31",
"gizmo": [
"#f3a535",
"#ffad38",
"#9b6922"
],
"glyph_bg": "#201607",
- "glyph_edge": "#bd812a",
- "glyph_text": "#fff0ca",
+ "glyph_edge": "#e0d1ac",
+ "glyph_text": "#e0d1ac",
"grid": "#21170b",
"grid_major": "#362511",
"heading_bg": "#080602",
@@ -129,10 +129,10 @@
"#855a1d"
],
"manipulator": "#ffad38",
- "mesh_accent": "#d6922f",
- "mesh_fill": "#7e561c",
- "mesh_ink": "#f0a335",
- "mesh_soft": "#291c09",
+ "mesh_accent": "#e6be68",
+ "mesh_fill": "#fed57f",
+ "mesh_ink": "#ffd680",
+ "mesh_soft": "#2d2313",
"on_accent": "#170d03",
"origin_plane": "#c6872c20",
"origin_plane_edge": "#c6872c80",
@@ -146,10 +146,10 @@
"preview_new": "#9f6c28",
"preview_sketch": "#d4902f",
"profile_fill": "#be812f20",
- "render_accent": "#d6922f",
- "render_fill": "#7e561c",
- "render_ink": "#f0a335",
- "render_soft": "#291c09",
+ "render_accent": "#bb7a29",
+ "render_fill": "#d28f42",
+ "render_ink": "#b97827",
+ "render_soft": "#241808",
"rubber_band": "#ffad38",
"section_cap": "#ba7e29",
"sel_edge": "#ffbc48",
@@ -160,26 +160,26 @@
"sel_vertex": "#ffbc48",
"selected_bg": "#3c290d",
"selected_ink": "#ffe8b3",
- "sheet_fill": "#7e561c",
- "sheet_ink": "#f0a335",
- "sheet_soft": "#291c09",
+ "sheet_fill": "#f7c769",
+ "sheet_ink": "#f3c365",
+ "sheet_soft": "#2b2110",
"sketch": "#ffbc48",
- "sketch_accent": "#d6922f",
+ "sketch_accent": "#e0b873",
"sketch_centerline": "#ba7e29",
"sketch_construction": "#ad7626",
"sketch_fixed": "#c68b2f",
- "sketch_ink": "#f0a335",
+ "sketch_ink": "#f7ce88",
"sketch_locked": "#d4902f",
"sketch_lost": "#fff0ca",
"sketch_point": "#ffbc48",
"sketch_point_free": "#ffbc48",
"sketch_projected": "#cb8a2d",
- "sketch_soft": "#291c09",
+ "sketch_soft": "#2c2214",
"subheading_bg": "#0c0803",
- "surface_accent": "#d6922f",
- "surface_fill": "#7e561c",
- "surface_ink": "#f0a335",
- "surface_soft": "#291c09",
+ "surface_accent": "#dd9a2f",
+ "surface_fill": "#f5b04a",
+ "surface_ink": "#eaa63e",
+ "surface_soft": "#2a1e0b",
"tab_on_fill_dark": "#170d03",
"text": "#f3ca87",
"text_dim": "#9b6922",
@@ -198,5 +198,56 @@
"warning": "#ffd274"
},
"format": "solidcraft-theme/1",
- "name": "Amber Phosphor"
+ "name": "Amber Phosphor",
+ "radii": {
+ "radius_sm": 0,
+ "radius_md": 0,
+ "radius_lg": 0,
+ "radius_xl": 0,
+ "control_radius": 0,
+ "sketch_mode_radius": 0
+ },
+ "icon_palette": {
+ "ink": "#090602",
+ "line": "#f3ca87",
+ "passive-1": "#d3bda4",
+ "passive-2": "#a69179",
+ "passive-3": "#7c6851",
+ "guide": "#9b6922",
+ "solid": [
+ "#fde0b5",
+ "#fec25f",
+ "#eba930"
+ ],
+ "surface": [
+ "#ffcc88",
+ "#f5b04a",
+ "#dd9a2f"
+ ],
+ "mesh": [
+ "#feedca",
+ "#fed57f",
+ "#e6be68"
+ ],
+ "form": [
+ "#f9b55d",
+ "#e19e45",
+ "#ca892b"
+ ],
+ "sketch": [
+ "#fdeac9",
+ "#f8cf89",
+ "#e0b873"
+ ],
+ "constraint": [
+ "#fceec8",
+ "#f7e8c2",
+ "#e0d1ac"
+ ],
+ "construction": [
+ "#ffcc88",
+ "#f5b04a",
+ "#dd9a2f"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/blueprint.json b/assets/styles/ui/themes/blueprint.json
index 58e6ed6912..a04a3fe723 100644
--- a/assets/styles/ui/themes/blueprint.json
+++ b/assets/styles/ui/themes/blueprint.json
@@ -30,7 +30,7 @@
"box_crossing": "#6ee0bb",
"box_window": "#66ddff",
"chip": "#1f5278",
- "construction_geom": "#78b8dc",
+ "construction_geom": "#daaf75",
"construction_plane": "#b7dcf01c",
"continuity": [
"#6ee0bb",
@@ -54,25 +54,25 @@
"dimension_driven": "#94b2cb",
"error": "#ff968d",
"field": "#071d35",
- "form_accent": "#78c6e8",
+ "form_accent": "#baade8",
"form_dim": "#94b2cb",
"form_error": "#ff968d",
"form_error_fill": "#422d40",
- "form_fill": "#4386ac",
+ "form_fill": "#d0c5fb",
"form_ink": "#c3e6f6",
"form_primary": "#66ddff",
- "form_soft": "#132f4c",
+ "form_soft": "#203250",
"form_success": "#6ee0bb",
"form_success_fill": "#153e47",
- "form_tab_ink": "#c3e6f6",
+ "form_tab_ink": "#b6a9e4",
"gizmo": [
"#ec9e99",
"#9ddab7",
"#91c8ff"
],
"glyph_bg": "#0a233e",
- "glyph_edge": "#e6b3a6",
- "glyph_text": "#e6b3a6",
+ "glyph_edge": "#ff968d",
+ "glyph_text": "#ff968d",
"grid": "#214975",
"grid_major": "#315d89",
"heading_bg": "#06111e",
@@ -129,10 +129,10 @@
"#4386ac"
],
"manipulator": "#66ddff",
- "mesh_accent": "#78c6e8",
- "mesh_fill": "#4386ac",
- "mesh_ink": "#c3e6f6",
- "mesh_soft": "#132f4c",
+ "mesh_accent": "#c7b96a",
+ "mesh_fill": "#decf80",
+ "mesh_ink": "#e7d889",
+ "mesh_soft": "#263845",
"on_accent": "#07192f",
"origin_plane": "#b7dcf024",
"origin_plane_edge": "#a3cce480",
@@ -146,10 +146,10 @@
"preview_new": "#d2e8f7",
"preview_sketch": "#6ee0bb",
"profile_fill": "#c9eaff12",
- "render_accent": "#78c6e8",
- "render_fill": "#4386ac",
- "render_ink": "#c3e6f6",
- "render_soft": "#132f4c",
+ "render_accent": "#e2a2b9",
+ "render_fill": "#fab8d0",
+ "render_ink": "#e6a6bd",
+ "render_soft": "#26324b",
"rubber_band": "#66ddff",
"section_cap": "#e7b374",
"sel_edge": "#66ddff",
@@ -160,26 +160,26 @@
"sel_vertex": "#66ddff",
"selected_bg": "#153c60",
"selected_ink": "#b6f2ff",
- "sheet_fill": "#4386ac",
- "sheet_ink": "#c3e6f6",
- "sheet_soft": "#132f4c",
+ "sheet_fill": "#a5d9dc",
+ "sheet_ink": "#a4d8db",
+ "sheet_soft": "#1e384f",
"sketch": "#eaf6ff",
- "sketch_accent": "#78c6e8",
+ "sketch_accent": "#8bc7a5",
"sketch_centerline": "#e7b374",
"sketch_construction": "#78b8dc",
"sketch_fixed": "#e3f0fa",
- "sketch_ink": "#c3e6f6",
+ "sketch_ink": "#9ddab7",
"sketch_locked": "#6ee0bb",
"sketch_lost": "#ff968d",
"sketch_point": "#e3f0fa",
"sketch_point_free": "#66ddff",
"sketch_projected": "#9cd6ef",
- "sketch_soft": "#132f4c",
+ "sketch_soft": "#1d384b",
"subheading_bg": "#091a2d",
- "surface_accent": "#78c6e8",
- "surface_fill": "#4386ac",
- "surface_ink": "#c3e6f6",
- "surface_soft": "#132f4c",
+ "surface_accent": "#daaf75",
+ "surface_fill": "#f1c58a",
+ "surface_ink": "#f1c58a",
+ "surface_soft": "#273645",
"tab_on_fill_dark": "#07192f",
"text": "#e3f0fa",
"text_dim": "#94b2cb",
@@ -198,5 +198,79 @@
"warning": "#f0d18c"
},
"format": "solidcraft-theme/1",
- "name": "Blueprint"
+ "name": "Blueprint",
+ "radii": {
+ "radius_sm": 4,
+ "radius_md": 6,
+ "radius_lg": 8,
+ "radius_xl": 10,
+ "control_radius": 6,
+ "sketch_mode_radius": 7
+ },
+ "borders": {
+ "primary": {
+ "width": 1,
+ "color": "#ffffff"
+ },
+ "secondary": {
+ "width": 1,
+ "color": "#e5efff",
+ "pattern": "dotted"
+ },
+ "tertiary": {
+ "width": 1,
+ "color": "#102748"
+ },
+ "container": {
+ "width": 1,
+ "color": "#a8c8ed"
+ },
+ "control": {
+ "width": 1,
+ "color": "#a8c8ed"
+ }
+ },
+ "icon_palette": {
+ "ink": "#07192f",
+ "line": "#e3f0fa",
+ "passive-1": "#b8c2cc",
+ "passive-2": "#8d97a0",
+ "passive-3": "#646d76",
+ "guide": "#94b2cb",
+ "solid": [
+ "#bceefe",
+ "#77defd",
+ "#4fc9ea"
+ ],
+ "surface": [
+ "#fde0b9",
+ "#f1c58a",
+ "#daaf75"
+ ],
+ "mesh": [
+ "#f5e697",
+ "#decf80",
+ "#c7b96a"
+ ],
+ "form": [
+ "#e6e0fe",
+ "#d0c5fb",
+ "#baade8"
+ ],
+ "sketch": [
+ "#b8f5d2",
+ "#a1debb",
+ "#8bc7a5"
+ ],
+ "constraint": [
+ "#ffdbd7",
+ "#fcbbb5",
+ "#ff968d"
+ ],
+ "construction": [
+ "#fde0b9",
+ "#f1c58a",
+ "#daaf75"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/catppuccin-mocha.json b/assets/styles/ui/themes/catppuccin-mocha.json
index 523c6171a7..7e2a2f61ac 100644
--- a/assets/styles/ui/themes/catppuccin-mocha.json
+++ b/assets/styles/ui/themes/catppuccin-mocha.json
@@ -30,7 +30,7 @@
"box_crossing": "#a6e3a1",
"box_window": "#cba6f7",
"chip": "#cba6f7",
- "construction_geom": "#f9e2af",
+ "construction_geom": "#eba57a",
"construction_plane": "#f9e2af22",
"continuity": [
"#a6e3a1",
@@ -54,25 +54,25 @@
"dimension_driven": "#a6adc8",
"error": "#f38ba8",
"field": "#181825",
- "form_accent": "#cba6f7",
+ "form_accent": "#a9b2f2",
"form_dim": "#a6adc8",
"form_error": "#f38ba8",
"form_error_fill": "#493446",
- "form_fill": "#477dc8",
+ "form_fill": "#c1cafe",
"form_ink": "#cdd6f4",
"form_primary": "#cba6f7",
- "form_soft": "#302b46",
+ "form_soft": "#303147",
"form_success": "#a6e3a1",
"form_success_fill": "#353f42",
- "form_tab_ink": "#cdd6f4",
+ "form_tab_ink": "#b4befe",
"gizmo": [
"#f38ba8",
"#a6e3a1",
"#477dc8"
],
"glyph_bg": "#313244",
- "glyph_edge": "#f38ba8",
- "glyph_text": "#f38ba8",
+ "glyph_edge": "#fc93b0",
+ "glyph_text": "#fc93b0",
"grid": "#242531",
"grid_major": "#363846",
"heading_bg": "#0f0f17",
@@ -129,10 +129,10 @@
"#586382"
],
"manipulator": "#cba6f7",
- "mesh_accent": "#cba6f7",
- "mesh_fill": "#477dc8",
- "mesh_ink": "#cdd6f4",
- "mesh_soft": "#302b46",
+ "mesh_accent": "#cbb583",
+ "mesh_fill": "#e2cb99",
+ "mesh_ink": "#f9e2af",
+ "mesh_soft": "#38363d",
"on_accent": "#06121b",
"origin_plane": "#f9e2af28",
"origin_plane_edge": "#f9e2af88",
@@ -146,10 +146,10 @@
"preview_new": "#f9e2af",
"preview_sketch": "#a6e3a1",
"profile_fill": "#477dc822",
- "render_accent": "#cba6f7",
- "render_fill": "#477dc8",
- "render_ink": "#cdd6f4",
- "render_soft": "#302b46",
+ "render_accent": "#fc93b0",
+ "render_fill": "#feb7c8",
+ "render_ink": "#f38ba8",
+ "render_soft": "#382b3d",
"rubber_band": "#cba6f7",
"section_cap": "#f9e2af",
"sel_edge": "#477dc8",
@@ -160,26 +160,26 @@
"sel_vertex": "#477dc8",
"selected_bg": "#365280",
"selected_ink": "#cdd6f4",
- "sheet_fill": "#477dc8",
- "sheet_ink": "#cdd6f4",
- "sheet_soft": "#302b46",
+ "sheet_fill": "#8addec",
+ "sheet_ink": "#89dceb",
+ "sheet_soft": "#2b3545",
"sketch": "#477dc8",
- "sketch_accent": "#cba6f7",
+ "sketch_accent": "#8eca89",
"sketch_centerline": "#f9e2af",
"sketch_construction": "#f9e2af",
"sketch_fixed": "#cdd6f4",
- "sketch_ink": "#cdd6f4",
+ "sketch_ink": "#a6e3a1",
"sketch_locked": "#a6e3a1",
"sketch_lost": "#f38ba8",
"sketch_point": "#cdd6f4",
"sketch_point_free": "#477dc8",
"sketch_projected": "#cba6f7",
- "sketch_soft": "#302b46",
+ "sketch_soft": "#2e363c",
"subheading_bg": "#161622",
- "surface_accent": "#cba6f7",
- "surface_fill": "#477dc8",
- "surface_ink": "#cdd6f4",
- "surface_soft": "#302b46",
+ "surface_accent": "#eba57a",
+ "surface_fill": "#febe96",
+ "surface_ink": "#fab387",
+ "surface_soft": "#383039",
"tab_on_fill_dark": "#181825",
"text": "#cdd6f4",
"text_dim": "#a6adc8",
@@ -198,5 +198,48 @@
"warning": "#f9e2af"
},
"format": "solidcraft-theme/1",
- "name": "Catppuccin Mocha"
+ "name": "Catppuccin Mocha",
+ "icon_palette": {
+ "ink": "#181825",
+ "line": "#cdd6f4",
+ "passive-1": "#bec0ca",
+ "passive-2": "#92959e",
+ "passive-3": "#696b74",
+ "guide": "#a6adc8",
+ "solid": [
+ "#ebdefe",
+ "#dbc0fc",
+ "#c9a4f5"
+ ],
+ "surface": [
+ "#fdddca",
+ "#febe96",
+ "#eba57a"
+ ],
+ "mesh": [
+ "#f9e2af",
+ "#e2cb99",
+ "#cbb583"
+ ],
+ "form": [
+ "#dee3fd",
+ "#c1cafe",
+ "#a9b2f2"
+ ],
+ "sketch": [
+ "#baf8b5",
+ "#a4e09f",
+ "#8eca89"
+ ],
+ "constraint": [
+ "#fddae2",
+ "#feb7c8",
+ "#fc93b0"
+ ],
+ "construction": [
+ "#fdddca",
+ "#febe96",
+ "#eba57a"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/cupertino.json b/assets/styles/ui/themes/cupertino.json
index dacbd49d22..8a1a5d983e 100644
--- a/assets/styles/ui/themes/cupertino.json
+++ b/assets/styles/ui/themes/cupertino.json
@@ -30,7 +30,7 @@
"box_crossing": "#39a75b",
"box_window": "#007aff",
"chip": "#007aff",
- "construction_geom": "#9a712b",
+ "construction_geom": "#a06f28",
"construction_plane": "#efd3a146",
"continuity": [
"#009e73",
@@ -54,25 +54,25 @@
"dimension_driven": "#6e6e73",
"error": "#d53137",
"field": "#ffffff",
- "form_accent": "#8055be",
+ "form_accent": "#8b62bf",
"form_dim": "#6e6e73",
"form_error": "#c02b31",
"form_error_fill": "#fcebea",
- "form_fill": "#946bc9",
+ "form_fill": "#c39afc",
"form_ink": "#262628",
"form_primary": "#0071e3",
- "form_soft": "#eee8f7",
+ "form_soft": "#e5e2e9",
"form_success": "#237b38",
"form_success_fill": "#e6f3e8",
- "form_tab_ink": "#7445af",
+ "form_tab_ink": "#75559f",
"gizmo": [
"#ed514b",
"#36ad59",
"#2184e9"
],
"glyph_bg": "#ffffff",
- "glyph_edge": "#ce8d85",
- "glyph_text": "#c34136",
+ "glyph_edge": "#d73339",
+ "glyph_text": "#d73339",
"grid": "#d0d2d6",
"grid_major": "#b5b8be",
"heading_bg": "#e2e2e2",
@@ -129,10 +129,10 @@
"#2b71be"
],
"manipulator": "#007aff",
- "mesh_accent": "#927300",
- "mesh_fill": "#d0ac35",
- "mesh_ink": "#856700",
- "mesh_soft": "#fbf5df",
+ "mesh_accent": "#937717",
+ "mesh_fill": "#d1ad37",
+ "mesh_ink": "#79641f",
+ "mesh_soft": "#eae7dd",
"on_accent": "#ffffff",
"origin_plane": "#f0c58a55",
"origin_plane_edge": "#bf915ac8",
@@ -146,10 +146,10 @@
"preview_new": "#e9d875",
"preview_sketch": "#3ab86b",
"profile_fill": "#f3c88a3d",
- "render_accent": "#af4083",
- "render_fill": "#bd5b92",
- "render_ink": "#9f3676",
- "render_soft": "#f6e8f0",
+ "render_accent": "#b4538a",
+ "render_fill": "#f18ac2",
+ "render_ink": "#974975",
+ "render_soft": "#e8e0e5",
"rubber_band": "#007aff",
"section_cap": "#c79769",
"sel_edge": "#007aff",
@@ -160,26 +160,26 @@
"sel_vertex": "#316cae",
"selected_bg": "#dcecff",
"selected_ink": "#004b9b",
- "sheet_fill": "#3884a5",
- "sheet_ink": "#226b89",
- "sheet_soft": "#e6f1f6",
+ "sheet_fill": "#71bcdf",
+ "sheet_ink": "#2d6a84",
+ "sheet_soft": "#dee4e6",
"sketch": "#1264bf",
- "sketch_accent": "#288049",
+ "sketch_accent": "#388e56",
"sketch_centerline": "#b77c47",
"sketch_construction": "#cb8b37",
"sketch_fixed": "#262628",
- "sketch_ink": "#23723f",
+ "sketch_ink": "#236f40",
"sketch_locked": "#318348",
"sketch_lost": "#c94f68",
"sketch_point": "#262628",
"sketch_point_free": "#1264bf",
"sketch_projected": "#9258b7",
- "sketch_soft": "#eaf4ed",
+ "sketch_soft": "#dce3df",
"subheading_bg": "#e8e8e8",
- "surface_accent": "#996a28",
- "surface_fill": "#b5833e",
- "surface_ink": "#8b5c1d",
- "surface_soft": "#f8efdf",
+ "surface_accent": "#a06f28",
+ "surface_fill": "#daa662",
+ "surface_ink": "#825e2d",
+ "surface_soft": "#e8e4de",
"tab_on_fill_dark": "#242426",
"text": "#262628",
"text_dim": "#6e6e73",
@@ -198,5 +198,56 @@
"warning": "#ad7400"
},
"format": "solidcraft-theme/1",
- "name": "Cupertino"
+ "name": "Cupertino",
+ "radii": {
+ "radius_sm": 6,
+ "radius_md": 8,
+ "radius_lg": 12,
+ "radius_xl": 16,
+ "control_radius": 8,
+ "sketch_mode_radius": 9
+ },
+ "icon_palette": {
+ "ink": "#262628",
+ "line": "#505054",
+ "passive-1": "#dee5ee",
+ "passive-2": "#aeb5bd",
+ "passive-3": "#81878f",
+ "guide": "#6e6e73",
+ "solid": [
+ "#dbe9fe",
+ "#81b3fa",
+ "#1875eb"
+ ],
+ "surface": [
+ "#fde3c4",
+ "#daa662",
+ "#a06f28"
+ ],
+ "mesh": [
+ "#fee7a2",
+ "#d1ad37",
+ "#937717"
+ ],
+ "form": [
+ "#ede2ff",
+ "#c39afc",
+ "#8b62bf"
+ ],
+ "sketch": [
+ "#b1fdc5",
+ "#72c78b",
+ "#388e56"
+ ],
+ "constraint": [
+ "#fee0dd",
+ "#f98e87",
+ "#d73339"
+ ],
+ "construction": [
+ "#fde3c4",
+ "#daa662",
+ "#a06f28"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/graphite.json b/assets/styles/ui/themes/graphite.json
index 5a6a8fe057..ca1bc3dbbd 100644
--- a/assets/styles/ui/themes/graphite.json
+++ b/assets/styles/ui/themes/graphite.json
@@ -30,7 +30,7 @@
"box_crossing": "#83c69b",
"box_window": "#4aa3d8",
"chip": "#4aa3d8",
- "construction_geom": "#dbb879",
+ "construction_geom": "#c38c59",
"construction_plane": "#dbb87922",
"continuity": [
"#83c69b",
@@ -54,25 +54,25 @@
"dimension_driven": "#a0a6b0",
"error": "#ed7777",
"field": "#1c1e21",
- "form_accent": "#4aa3d8",
+ "form_accent": "#a08fc4",
"form_dim": "#a0a6b0",
"form_error": "#ed7777",
"form_error_fill": "#4d373a",
- "form_fill": "#2878a9",
+ "form_fill": "#b9a7df",
"form_ink": "#e0e2e5",
"form_primary": "#4aa3d8",
- "form_soft": "#293c49",
+ "form_soft": "#34343e",
"form_success": "#83c69b",
"form_success_fill": "#35423e",
- "form_tab_ink": "#e0e2e5",
+ "form_tab_ink": "#a796cb",
"gizmo": [
"#ed7777",
"#83c69b",
"#2878a9"
],
"glyph_bg": "#303338",
- "glyph_edge": "#ed7777",
- "glyph_text": "#ed7777",
+ "glyph_edge": "#e57071",
+ "glyph_text": "#e57071",
"grid": "#292b30",
"grid_major": "#393c42",
"heading_bg": "#121416",
@@ -129,10 +129,10 @@
"#68717d"
],
"manipulator": "#4aa3d8",
- "mesh_accent": "#4aa3d8",
- "mesh_fill": "#2878a9",
- "mesh_ink": "#e0e2e5",
- "mesh_soft": "#293c49",
+ "mesh_accent": "#b19747",
+ "mesh_fill": "#cab060",
+ "mesh_ink": "#cab060",
+ "mesh_soft": "#393731",
"on_accent": "#06121b",
"origin_plane": "#dbb87928",
"origin_plane_edge": "#dbb87988",
@@ -146,10 +146,10 @@
"preview_new": "#dbb879",
"preview_sketch": "#83c69b",
"profile_fill": "#2878a922",
- "render_accent": "#4aa3d8",
- "render_fill": "#2878a9",
- "render_ink": "#e0e2e5",
- "render_soft": "#293c49",
+ "render_accent": "#c0869b",
+ "render_fill": "#db9eb3",
+ "render_ink": "#c78fa3",
+ "render_soft": "#383339",
"rubber_band": "#4aa3d8",
"section_cap": "#dbb879",
"sel_edge": "#2878a9",
@@ -160,26 +160,26 @@
"sel_vertex": "#2878a9",
"selected_bg": "#245674",
"selected_ink": "#e0e2e5",
- "sheet_fill": "#2878a9",
- "sheet_ink": "#e0e2e5",
- "sheet_soft": "#293c49",
+ "sheet_fill": "#76c1c7",
+ "sheet_ink": "#6cb7bd",
+ "sheet_soft": "#2e383d",
"sketch": "#2878a9",
- "sketch_accent": "#4aa3d8",
+ "sketch_accent": "#7ba58b",
"sketch_centerline": "#dbb879",
"sketch_construction": "#dbb879",
"sketch_fixed": "#e0e2e5",
- "sketch_ink": "#e0e2e5",
+ "sketch_ink": "#88b298",
"sketch_locked": "#83c69b",
"sketch_lost": "#ed7777",
"sketch_point": "#e0e2e5",
"sketch_point_free": "#2878a9",
"sketch_projected": "#ad9cce",
- "sketch_soft": "#293c49",
+ "sketch_soft": "#313838",
"subheading_bg": "#1c1d20",
- "surface_accent": "#4aa3d8",
- "surface_fill": "#2878a9",
- "surface_ink": "#e0e2e5",
- "surface_soft": "#293c49",
+ "surface_accent": "#c38c59",
+ "surface_fill": "#dea572",
+ "surface_ink": "#d39b68",
+ "surface_soft": "#3a3532",
"tab_on_fill_dark": "#1c1e21",
"text": "#e0e2e5",
"text_dim": "#a0a6b0",
@@ -198,5 +198,48 @@
"warning": "#dbb879"
},
"format": "solidcraft-theme/1",
- "name": "Graphite"
+ "name": "Graphite",
+ "icon_palette": {
+ "ink": "#1c1e21",
+ "line": "#e0e2e5",
+ "passive-1": "#bfc1c5",
+ "passive-2": "#939599",
+ "passive-3": "#6a6c6f",
+ "guide": "#a0a6b0",
+ "solid": [
+ "#a0d7fb",
+ "#65bdf3",
+ "#4aa3d8"
+ ],
+ "surface": [
+ "#fcc28e",
+ "#dea572",
+ "#c38c59"
+ ],
+ "mesh": [
+ "#e8cd7d",
+ "#cab060",
+ "#b19747"
+ ],
+ "form": [
+ "#d5c4fd",
+ "#b9a7df",
+ "#a08fc4"
+ ],
+ "sketch": [
+ "#b0dbc0",
+ "#94bea4",
+ "#7ba58b"
+ ],
+ "constraint": [
+ "#febbb9",
+ "#fb8e8d",
+ "#e57071"
+ ],
+ "construction": [
+ "#fcc28e",
+ "#dea572",
+ "#c38c59"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/green-phosphor.json b/assets/styles/ui/themes/green-phosphor.json
index cd031de290..221de93f6d 100644
--- a/assets/styles/ui/themes/green-phosphor.json
+++ b/assets/styles/ui/themes/green-phosphor.json
@@ -30,7 +30,7 @@
"box_crossing": "#39d45c",
"box_window": "#4dff79",
"chip": "#144a20",
- "construction_geom": "#2fad4a",
+ "construction_geom": "#17c053",
"construction_plane": "#72c68b18",
"continuity": [
"#35c555",
@@ -54,25 +54,25 @@
"dimension_driven": "#5b9b6a",
"error": "#d8ffdf",
"field": "#061009",
- "form_accent": "#59d67b",
+ "form_accent": "#1faa4e",
"form_dim": "#5b9b6a",
"form_error": "#d8ffdf",
"form_error_fill": "#21462a",
- "form_fill": "#287e43",
+ "form_fill": "#40c163",
"form_ink": "#9bf0b1",
"form_primary": "#4dff79",
- "form_soft": "#0e2918",
+ "form_soft": "#0c2413",
"form_success": "#39d45c",
"form_success_fill": "#133b20",
- "form_tab_ink": "#9bf0b1",
+ "form_tab_ink": "#36b95c",
"gizmo": [
"#c1f3ba",
"#4dff79",
"#599b70"
],
"glyph_bg": "#09200e",
- "glyph_edge": "#33bd51",
- "glyph_text": "#d8ffdf",
+ "glyph_edge": "#afd5b6",
+ "glyph_text": "#afd5b6",
"grid": "#091b0f",
"grid_major": "#122d1a",
"heading_bg": "#030804",
@@ -129,10 +129,10 @@
"#34854b"
],
"manipulator": "#4dff79",
- "mesh_accent": "#59d67b",
- "mesh_fill": "#287e43",
- "mesh_ink": "#9bf0b1",
- "mesh_soft": "#0e2918",
+ "mesh_accent": "#75d989",
+ "mesh_fill": "#8cf09f",
+ "mesh_ink": "#9affad",
+ "mesh_soft": "#182d1d",
"on_accent": "#031207",
"origin_plane": "#72c68b20",
"origin_plane_edge": "#72c68b80",
@@ -146,10 +146,10 @@
"preview_new": "#319f4b",
"preview_sketch": "#39d45c",
"profile_fill": "#2fbe5320",
- "render_accent": "#59d67b",
- "render_fill": "#287e43",
- "render_ink": "#9bf0b1",
- "render_soft": "#0e2918",
+ "render_accent": "#259548",
+ "render_fill": "#40ab5c",
+ "render_ink": "#2e9c4e",
+ "render_soft": "#0b2111",
"rubber_band": "#4dff79",
"section_cap": "#32ba50",
"sel_edge": "#4dff79",
@@ -160,26 +160,26 @@
"sel_vertex": "#4dff79",
"selected_bg": "#123c20",
"selected_ink": "#b3ffc4",
- "sheet_fill": "#287e43",
- "sheet_ink": "#9bf0b1",
- "sheet_soft": "#0e2918",
+ "sheet_fill": "#6ee08e",
+ "sheet_ink": "#74e694",
+ "sheet_soft": "#132a1a",
"sketch": "#4dff79",
- "sketch_accent": "#59d67b",
+ "sketch_accent": "#94d7a4",
"sketch_centerline": "#32ba50",
"sketch_construction": "#2fad4a",
"sketch_fixed": "#8def9f",
- "sketch_ink": "#9bf0b1",
+ "sketch_ink": "#bbffca",
"sketch_locked": "#39d45c",
"sketch_lost": "#d8ffdf",
"sketch_point": "#8def9f",
"sketch_point_free": "#4dff79",
"sketch_projected": "#37cb57",
- "sketch_soft": "#0e2918",
+ "sketch_soft": "#1c2d20",
"subheading_bg": "#040c07",
- "surface_accent": "#59d67b",
- "surface_fill": "#287e43",
- "surface_ink": "#9bf0b1",
- "surface_soft": "#0e2918",
+ "surface_accent": "#17c053",
+ "surface_fill": "#3fd86a",
+ "surface_ink": "#40d86a",
+ "surface_soft": "#0d2815",
"tab_on_fill_dark": "#031207",
"text": "#8def9f",
"text_dim": "#5b9b6a",
@@ -198,5 +198,56 @@
"warning": "#d1ffad"
},
"format": "solidcraft-theme/1",
- "name": "Green Phosphor"
+ "name": "Green Phosphor",
+ "radii": {
+ "radius_sm": 0,
+ "radius_md": 0,
+ "radius_lg": 0,
+ "radius_xl": 0,
+ "control_radius": 0,
+ "sketch_mode_radius": 0
+ },
+ "icon_palette": {
+ "ink": "#020904",
+ "line": "#8def9f",
+ "passive-1": "#abcab2",
+ "passive-2": "#809e87",
+ "passive-3": "#58745e",
+ "guide": "#5b9b6a",
+ "solid": [
+ "#a5fdb1",
+ "#3df46e",
+ "#3bd964"
+ ],
+ "surface": [
+ "#5cef80",
+ "#3fd86a",
+ "#17c053"
+ ],
+ "mesh": [
+ "#c5fecd",
+ "#8cf09f",
+ "#75d989"
+ ],
+ "form": [
+ "#5ad879",
+ "#40c163",
+ "#1faa4e"
+ ],
+ "sketch": [
+ "#c8ffd3",
+ "#abeeba",
+ "#94d7a4"
+ ],
+ "constraint": [
+ "#d3fada",
+ "#c5eccc",
+ "#afd5b6"
+ ],
+ "construction": [
+ "#5cef80",
+ "#3fd86a",
+ "#17c053"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/gruvbox-dark-hard.json b/assets/styles/ui/themes/gruvbox-dark-hard.json
index 646057927f..1fac3d49f6 100644
--- a/assets/styles/ui/themes/gruvbox-dark-hard.json
+++ b/assets/styles/ui/themes/gruvbox-dark-hard.json
@@ -12,7 +12,7 @@
"text_dim": "#a89984",
"accent": "#83a598",
"accent_soft": "#414f4b",
- "sketch_accent": "#83a598",
+ "sketch_accent": "#a1a322",
"error": "#fb4934",
"warning": "#fabd2f",
"icon": "#d5c4a1",
@@ -34,7 +34,7 @@
"axis_y": "#b8bb26",
"axis_z": "#83a598",
"construction_plane": "#fe801940",
- "construction_geom": "#fe8019",
+ "construction_geom": "#e97926",
"body": "#a89984",
"body_edge": "#141617",
"manipulator": "#83a598",
@@ -64,8 +64,8 @@
"section_cap": "#d65d0e",
"profile_fill": "#83a59828",
"glyph_bg": "#2c2c2c",
- "glyph_edge": "#d65d0e",
- "glyph_text": "#fe8019",
+ "glyph_edge": "#fe614c",
+ "glyph_text": "#fe614c",
"overlay": "#1d2021f0",
"rubber_band": "#83a598",
"app_bar_text": "#ebdbb2",
@@ -93,6 +93,86 @@
"#b8bb26",
"#83a598"
],
- "icons.agent": "#d3869b"
+ "icons.agent": "#d3869b",
+ "surface_fill": "#fe9755",
+ "surface_soft": "#382c20",
+ "surface_ink": "#fe8019",
+ "surface_accent": "#e97926",
+ "mesh_fill": "#e1ab32",
+ "mesh_soft": "#383323",
+ "mesh_ink": "#fabd2f",
+ "mesh_accent": "#c39429",
+ "form_fill": "#ea9bb0",
+ "form_soft": "#332c30",
+ "form_tab_ink": "#d3869b",
+ "form_accent": "#cf8297",
+ "sheet_fill": "#93c681",
+ "sheet_soft": "#2b332c",
+ "sheet_ink": "#8ec07c",
+ "render_fill": "#fc9483",
+ "render_soft": "#382523",
+ "render_ink": "#fb5d4a",
+ "render_accent": "#fe614c",
+ "sketch_soft": "#303322",
+ "sketch_ink": "#b8bb26",
+ "form_ink": "#ebdbb2",
+ "form_dim": "#bdae93",
+ "form_primary": "#83a598",
+ "form_error": "#fb4934",
+ "form_error_fill": "#63221f",
+ "form_success": "#b8bb26",
+ "form_success_fill": "#343a28",
+ "dialog_body": "#1d2021",
+ "dialog_footer": "#3c3836",
+ "dialog_rule": "#504945",
+ "control_fill": "#141617",
+ "control_border": "#7c6f64",
+ "dialog_label": "#ebdbb2",
+ "selected_ink": "#ebdbb2",
+ "selected_bg": "#414f4b",
+ "on_accent": "#1d2021"
+ },
+ "icon_palette": {
+ "ink": "#141617",
+ "line": "#d5c4a1",
+ "passive-1": "#c5c0b8",
+ "passive-2": "#9a948d",
+ "passive-3": "#706b64",
+ "guide": "#a89984",
+ "solid": [
+ "#b8dbcd",
+ "#9bbeb1",
+ "#83a598"
+ ],
+ "surface": [
+ "#fcc4a3",
+ "#fe9755",
+ "#e97926"
+ ],
+ "mesh": [
+ "#fbca67",
+ "#e1ab32",
+ "#c39429"
+ ],
+ "form": [
+ "#fbbfce",
+ "#ea9bb0",
+ "#cf8297"
+ ],
+ "sketch": [
+ "#d7db50",
+ "#babd2a",
+ "#a1a322"
+ ],
+ "constraint": [
+ "#fcc2b7",
+ "#fc9483",
+ "#fe614c"
+ ],
+ "construction": [
+ "#fcc4a3",
+ "#fe9755",
+ "#e97926"
+ ]
}
}
diff --git a/assets/styles/ui/themes/gruvbox-dark-soft.json b/assets/styles/ui/themes/gruvbox-dark-soft.json
index 34a895cc9c..6a5daef40b 100644
--- a/assets/styles/ui/themes/gruvbox-dark-soft.json
+++ b/assets/styles/ui/themes/gruvbox-dark-soft.json
@@ -12,7 +12,7 @@
"text_dim": "#a89984",
"accent": "#83a598",
"accent_soft": "#4e5954",
- "sketch_accent": "#83a598",
+ "sketch_accent": "#a1a322",
"error": "#fb4934",
"warning": "#fabd2f",
"icon": "#d5c4a1",
@@ -34,7 +34,7 @@
"axis_y": "#b8bb26",
"axis_z": "#83a598",
"construction_plane": "#fe801940",
- "construction_geom": "#fe8019",
+ "construction_geom": "#e97926",
"body": "#a89984",
"body_edge": "#1d2021",
"manipulator": "#83a598",
@@ -64,8 +64,8 @@
"section_cap": "#d65d0e",
"profile_fill": "#83a59828",
"glyph_bg": "#373432",
- "glyph_edge": "#d65d0e",
- "glyph_text": "#fe8019",
+ "glyph_edge": "#fe614c",
+ "glyph_text": "#fe614c",
"overlay": "#32302ff0",
"rubber_band": "#83a598",
"app_bar_text": "#ebdbb2",
@@ -93,6 +93,86 @@
"#b8bb26",
"#83a598"
],
- "icons.agent": "#d3869b"
+ "icons.agent": "#d3869b",
+ "surface_fill": "#fe9755",
+ "surface_soft": "#4a3a2c",
+ "surface_ink": "#fe8b2e",
+ "surface_accent": "#e97926",
+ "mesh_fill": "#e1ab32",
+ "mesh_soft": "#4a412f",
+ "mesh_ink": "#fabd2f",
+ "mesh_accent": "#c39429",
+ "form_fill": "#ea9bb0",
+ "form_soft": "#453a3c",
+ "form_tab_ink": "#d996a8",
+ "form_accent": "#cf8297",
+ "sheet_fill": "#93c681",
+ "sheet_soft": "#3d4138",
+ "sheet_ink": "#8ec07c",
+ "render_fill": "#fc9483",
+ "render_soft": "#4a3330",
+ "render_ink": "#fc7e6f",
+ "render_accent": "#fe614c",
+ "sketch_soft": "#42412e",
+ "sketch_ink": "#b8bb26",
+ "form_ink": "#ebdbb2",
+ "form_dim": "#bdae93",
+ "form_primary": "#83a598",
+ "form_error": "#fb4934",
+ "form_error_fill": "#702b28",
+ "form_success": "#b8bb26",
+ "form_success_fill": "#343a28",
+ "dialog_body": "#32302f",
+ "dialog_footer": "#3c3836",
+ "dialog_rule": "#504945",
+ "control_fill": "#1d2021",
+ "control_border": "#7c6f64",
+ "dialog_label": "#ebdbb2",
+ "selected_ink": "#ebdbb2",
+ "selected_bg": "#4e5954",
+ "on_accent": "#1d2021"
+ },
+ "icon_palette": {
+ "ink": "#1d2021",
+ "line": "#d5c4a1",
+ "passive-1": "#c5c0b8",
+ "passive-2": "#9a948d",
+ "passive-3": "#706b64",
+ "guide": "#a89984",
+ "solid": [
+ "#b8dbcd",
+ "#9bbeb1",
+ "#83a598"
+ ],
+ "surface": [
+ "#fcc4a3",
+ "#fe9755",
+ "#e97926"
+ ],
+ "mesh": [
+ "#fbca67",
+ "#e1ab32",
+ "#c39429"
+ ],
+ "form": [
+ "#fbbfce",
+ "#ea9bb0",
+ "#cf8297"
+ ],
+ "sketch": [
+ "#d7db50",
+ "#babd2a",
+ "#a1a322"
+ ],
+ "constraint": [
+ "#fcc2b7",
+ "#fc9483",
+ "#fe614c"
+ ],
+ "construction": [
+ "#fcc4a3",
+ "#fe9755",
+ "#e97926"
+ ]
}
}
diff --git a/assets/styles/ui/themes/gruvbox-dark.json b/assets/styles/ui/themes/gruvbox-dark.json
index 320f9ed96a..2224cf99d7 100644
--- a/assets/styles/ui/themes/gruvbox-dark.json
+++ b/assets/styles/ui/themes/gruvbox-dark.json
@@ -12,7 +12,7 @@
"text_dim": "#a89984",
"accent": "#83a598",
"accent_soft": "#48544f",
- "sketch_accent": "#83a598",
+ "sketch_accent": "#a1a322",
"error": "#fb4934",
"warning": "#fabd2f",
"icon": "#d5c4a1",
@@ -34,7 +34,7 @@
"axis_y": "#b8bb26",
"axis_z": "#83a598",
"construction_plane": "#fe801940",
- "construction_geom": "#fe8019",
+ "construction_geom": "#e97926",
"body": "#a89984",
"body_edge": "#1d2021",
"manipulator": "#83a598",
@@ -64,8 +64,8 @@
"section_cap": "#d65d0e",
"profile_fill": "#83a59828",
"glyph_bg": "#32302f",
- "glyph_edge": "#d65d0e",
- "glyph_text": "#fe8019",
+ "glyph_edge": "#fe614c",
+ "glyph_text": "#fe614c",
"overlay": "#282828f0",
"rubber_band": "#83a598",
"app_bar_text": "#ebdbb2",
@@ -93,6 +93,86 @@
"#b8bb26",
"#83a598"
],
- "icons.agent": "#d3869b"
+ "icons.agent": "#d3869b",
+ "surface_fill": "#fe9755",
+ "surface_soft": "#423326",
+ "surface_ink": "#fe8019",
+ "surface_accent": "#e97926",
+ "mesh_fill": "#e1ab32",
+ "mesh_soft": "#413a29",
+ "mesh_ink": "#fabd2f",
+ "mesh_accent": "#c39429",
+ "form_fill": "#ea9bb0",
+ "form_soft": "#3d3336",
+ "form_tab_ink": "#d58b9f",
+ "form_accent": "#cf8297",
+ "sheet_fill": "#93c681",
+ "sheet_soft": "#343a32",
+ "sheet_ink": "#8ec07c",
+ "render_fill": "#fc9483",
+ "render_soft": "#412c29",
+ "render_ink": "#fc6d5d",
+ "render_accent": "#fe614c",
+ "sketch_soft": "#393a28",
+ "sketch_ink": "#b8bb26",
+ "form_ink": "#ebdbb2",
+ "form_dim": "#bdae93",
+ "form_primary": "#83a598",
+ "form_error": "#fb4934",
+ "form_error_fill": "#6a2624",
+ "form_success": "#b8bb26",
+ "form_success_fill": "#343a28",
+ "dialog_body": "#282828",
+ "dialog_footer": "#3c3836",
+ "dialog_rule": "#504945",
+ "control_fill": "#1d2021",
+ "control_border": "#7c6f64",
+ "dialog_label": "#ebdbb2",
+ "selected_ink": "#ebdbb2",
+ "selected_bg": "#48544f",
+ "on_accent": "#1d2021"
+ },
+ "icon_palette": {
+ "ink": "#1d2021",
+ "line": "#d5c4a1",
+ "passive-1": "#c5c0b8",
+ "passive-2": "#9a948d",
+ "passive-3": "#706b64",
+ "guide": "#a89984",
+ "solid": [
+ "#b8dbcd",
+ "#9bbeb1",
+ "#83a598"
+ ],
+ "surface": [
+ "#fcc4a3",
+ "#fe9755",
+ "#e97926"
+ ],
+ "mesh": [
+ "#fbca67",
+ "#e1ab32",
+ "#c39429"
+ ],
+ "form": [
+ "#fbbfce",
+ "#ea9bb0",
+ "#cf8297"
+ ],
+ "sketch": [
+ "#d7db50",
+ "#babd2a",
+ "#a1a322"
+ ],
+ "constraint": [
+ "#fcc2b7",
+ "#fc9483",
+ "#fe614c"
+ ],
+ "construction": [
+ "#fcc4a3",
+ "#fe9755",
+ "#e97926"
+ ]
}
}
diff --git a/assets/styles/ui/themes/gruvbox-light-hard.json b/assets/styles/ui/themes/gruvbox-light-hard.json
index 902121fb66..690bced1a1 100644
--- a/assets/styles/ui/themes/gruvbox-light-hard.json
+++ b/assets/styles/ui/themes/gruvbox-light-hard.json
@@ -12,7 +12,7 @@
"text_dim": "#7c6f64",
"accent": "#076678",
"accent_soft": "#c9d8c4",
- "sketch_accent": "#076678",
+ "sketch_accent": "#625e15",
"error": "#9d0006",
"warning": "#b57614",
"icon": "#504945",
@@ -34,7 +34,7 @@
"axis_y": "#98971a",
"axis_z": "#458588",
"construction_plane": "#fe801946",
- "construction_geom": "#af3a03",
+ "construction_geom": "#9b3407",
"body": "#bdae93",
"body_edge": "#3c3836",
"manipulator": "#076678",
@@ -64,8 +64,8 @@
"section_cap": "#d65d0e",
"profile_fill": "#fabd2f46",
"glyph_bg": "#fcfaeb",
- "glyph_edge": "#af3a03",
- "glyph_text": "#af3a03",
+ "glyph_edge": "#a91714",
+ "glyph_text": "#a91714",
"overlay": "#f9f5d7eb",
"rubber_band": "#076678",
"app_bar_text": "#fbf1c7",
@@ -93,6 +93,86 @@
"#98971a",
"#458588"
],
- "icons.agent": "#8f3f71"
+ "icons.agent": "#8f3f71",
+ "surface_fill": "#df663c",
+ "surface_soft": "#f3e6c6",
+ "surface_ink": "#af3a03",
+ "surface_accent": "#9b3407",
+ "mesh_fill": "#c08024",
+ "mesh_soft": "#f4ebc7",
+ "mesh_ink": "#915e10",
+ "mesh_accent": "#7b5112",
+ "form_fill": "#c46fa2",
+ "form_soft": "#f1e6cf",
+ "form_tab_ink": "#8f3f71",
+ "form_accent": "#893a6c",
+ "sheet_fill": "#659f7a",
+ "sheet_soft": "#eaebcd",
+ "sheet_ink": "#3d7252",
+ "render_fill": "#e85a4d",
+ "render_soft": "#f2e1c6",
+ "render_ink": "#9d0006",
+ "render_accent": "#a91714",
+ "sketch_soft": "#efebc7",
+ "sketch_ink": "#6e6a0d",
+ "form_ink": "#3c3836",
+ "form_dim": "#665c54",
+ "form_primary": "#076678",
+ "form_error": "#9d0006",
+ "form_error_fill": "#f0cbb2",
+ "form_success": "#427b58",
+ "form_success_fill": "#dae3b6",
+ "dialog_body": "#f9f5d7",
+ "dialog_footer": "#ebdbb2",
+ "dialog_rule": "#d5c4a1",
+ "control_fill": "#fcfaeb",
+ "control_border": "#a89984",
+ "dialog_label": "#3c3836",
+ "selected_ink": "#3c3836",
+ "selected_bg": "#c9d8c4",
+ "on_accent": "#fbf1c7"
+ },
+ "icon_palette": {
+ "ink": "#3c3836",
+ "line": "#504945",
+ "passive-1": "#e9e3df",
+ "passive-2": "#b8b3af",
+ "passive-3": "#8a8581",
+ "guide": "#7c6f64",
+ "solid": [
+ "#87d5e9",
+ "#4e9caf",
+ "#076678"
+ ],
+ "surface": [
+ "#feb299",
+ "#df663c",
+ "#9b3407"
+ ],
+ "mesh": [
+ "#fcb864",
+ "#c08024",
+ "#7b5112"
+ ],
+ "form": [
+ "#fbaad9",
+ "#c46fa2",
+ "#893a6c"
+ ],
+ "sketch": [
+ "#d0cc73",
+ "#989439",
+ "#625e15"
+ ],
+ "constraint": [
+ "#fab3a8",
+ "#e85a4d",
+ "#a91714"
+ ],
+ "construction": [
+ "#feb299",
+ "#df663c",
+ "#9b3407"
+ ]
}
}
diff --git a/assets/styles/ui/themes/gruvbox-light-soft.json b/assets/styles/ui/themes/gruvbox-light-soft.json
index d8c1c97832..7128bdd9c0 100644
--- a/assets/styles/ui/themes/gruvbox-light-soft.json
+++ b/assets/styles/ui/themes/gruvbox-light-soft.json
@@ -12,7 +12,7 @@
"text_dim": "#7c6f64",
"accent": "#076678",
"accent_soft": "#c3ccae",
- "sketch_accent": "#076678",
+ "sketch_accent": "#625e15",
"error": "#9d0006",
"warning": "#b57614",
"icon": "#504945",
@@ -34,7 +34,7 @@
"axis_y": "#98971a",
"axis_z": "#458588",
"construction_plane": "#fe801946",
- "construction_geom": "#af3a03",
+ "construction_geom": "#9b3407",
"body": "#bdae93",
"body_edge": "#3c3836",
"manipulator": "#076678",
@@ -64,8 +64,8 @@
"section_cap": "#d65d0e",
"profile_fill": "#fabd2f46",
"glyph_bg": "#f8f2de",
- "glyph_edge": "#af3a03",
- "glyph_text": "#af3a03",
+ "glyph_edge": "#a91714",
+ "glyph_text": "#a91714",
"overlay": "#f2e5bceb",
"rubber_band": "#076678",
"app_bar_text": "#fbf1c7",
@@ -93,6 +93,86 @@
"#98971a",
"#458588"
],
- "icons.agent": "#8f3f71"
+ "icons.agent": "#8f3f71",
+ "surface_fill": "#df663c",
+ "surface_soft": "#edd7ad",
+ "surface_ink": "#a83803",
+ "surface_accent": "#9b3407",
+ "mesh_fill": "#c08024",
+ "mesh_soft": "#eddcaf",
+ "mesh_ink": "#84560f",
+ "mesh_accent": "#7b5112",
+ "form_fill": "#c46fa2",
+ "form_soft": "#ead8b6",
+ "form_tab_ink": "#8f3f71",
+ "form_accent": "#893a6c",
+ "sheet_fill": "#659f7a",
+ "sheet_soft": "#e4ddb4",
+ "sheet_ink": "#38694b",
+ "render_fill": "#e85a4d",
+ "render_soft": "#ebd3ad",
+ "render_ink": "#9d0006",
+ "render_accent": "#a91714",
+ "sketch_soft": "#e8dcae",
+ "sketch_ink": "#66610c",
+ "form_ink": "#3c3836",
+ "form_dim": "#665c54",
+ "form_primary": "#076678",
+ "form_error": "#9d0006",
+ "form_error_fill": "#eabe9c",
+ "form_success": "#427b58",
+ "form_success_fill": "#dae3b6",
+ "dialog_body": "#f2e5bc",
+ "dialog_footer": "#ebdbb2",
+ "dialog_rule": "#d5c4a1",
+ "control_fill": "#f8f2de",
+ "control_border": "#a89984",
+ "dialog_label": "#3c3836",
+ "selected_ink": "#3c3836",
+ "selected_bg": "#c3ccae",
+ "on_accent": "#fbf1c7"
+ },
+ "icon_palette": {
+ "ink": "#3c3836",
+ "line": "#504945",
+ "passive-1": "#e9e3df",
+ "passive-2": "#b8b3af",
+ "passive-3": "#8a8581",
+ "guide": "#7c6f64",
+ "solid": [
+ "#87d5e9",
+ "#4e9caf",
+ "#076678"
+ ],
+ "surface": [
+ "#feb299",
+ "#df663c",
+ "#9b3407"
+ ],
+ "mesh": [
+ "#fcb864",
+ "#c08024",
+ "#7b5112"
+ ],
+ "form": [
+ "#fbaad9",
+ "#c46fa2",
+ "#893a6c"
+ ],
+ "sketch": [
+ "#d0cc73",
+ "#989439",
+ "#625e15"
+ ],
+ "constraint": [
+ "#fab3a8",
+ "#e85a4d",
+ "#a91714"
+ ],
+ "construction": [
+ "#feb299",
+ "#df663c",
+ "#9b3407"
+ ]
}
}
diff --git a/assets/styles/ui/themes/gruvbox-light.json b/assets/styles/ui/themes/gruvbox-light.json
index c3789e80d0..7e750545b5 100644
--- a/assets/styles/ui/themes/gruvbox-light.json
+++ b/assets/styles/ui/themes/gruvbox-light.json
@@ -12,7 +12,7 @@
"text_dim": "#7c6f64",
"accent": "#076678",
"accent_soft": "#cad5b7",
- "sketch_accent": "#076678",
+ "sketch_accent": "#625e15",
"error": "#9d0006",
"warning": "#b57614",
"icon": "#504945",
@@ -34,7 +34,7 @@
"axis_y": "#98971a",
"axis_z": "#458588",
"construction_plane": "#fe801946",
- "construction_geom": "#af3a03",
+ "construction_geom": "#9b3407",
"body": "#bdae93",
"body_edge": "#3c3836",
"manipulator": "#076678",
@@ -64,8 +64,8 @@
"section_cap": "#d65d0e",
"profile_fill": "#fabd2f46",
"glyph_bg": "#fdf8e3",
- "glyph_edge": "#af3a03",
- "glyph_text": "#af3a03",
+ "glyph_edge": "#a91714",
+ "glyph_text": "#a91714",
"overlay": "#fbf1c7eb",
"rubber_band": "#076678",
"app_bar_text": "#fbf1c7",
@@ -93,6 +93,86 @@
"#98971a",
"#458588"
],
- "icons.agent": "#8f3f71"
+ "icons.agent": "#8f3f71",
+ "surface_fill": "#df663c",
+ "surface_soft": "#f5e2b7",
+ "surface_ink": "#af3a03",
+ "surface_accent": "#9b3407",
+ "mesh_fill": "#c08024",
+ "mesh_soft": "#f5e7b9",
+ "mesh_ink": "#8d5c10",
+ "mesh_accent": "#7b5112",
+ "form_fill": "#c46fa2",
+ "form_soft": "#f2e3c0",
+ "form_tab_ink": "#8f3f71",
+ "form_accent": "#893a6c",
+ "sheet_fill": "#659f7a",
+ "sheet_soft": "#ece8be",
+ "sheet_ink": "#3c7050",
+ "render_fill": "#e85a4d",
+ "render_soft": "#f3deb8",
+ "render_ink": "#9d0006",
+ "render_accent": "#a91714",
+ "sketch_soft": "#f1e7b8",
+ "sketch_ink": "#6d680d",
+ "form_ink": "#3c3836",
+ "form_dim": "#665c54",
+ "form_primary": "#076678",
+ "form_error": "#9d0006",
+ "form_error_fill": "#f2c8a5",
+ "form_success": "#427b58",
+ "form_success_fill": "#dae3b6",
+ "dialog_body": "#fbf1c7",
+ "dialog_footer": "#ebdbb2",
+ "dialog_rule": "#d5c4a1",
+ "control_fill": "#fdf8e3",
+ "control_border": "#a89984",
+ "dialog_label": "#3c3836",
+ "selected_ink": "#3c3836",
+ "selected_bg": "#cad5b7",
+ "on_accent": "#fbf1c7"
+ },
+ "icon_palette": {
+ "ink": "#3c3836",
+ "line": "#504945",
+ "passive-1": "#e9e3df",
+ "passive-2": "#b8b3af",
+ "passive-3": "#8a8581",
+ "guide": "#7c6f64",
+ "solid": [
+ "#87d5e9",
+ "#4e9caf",
+ "#076678"
+ ],
+ "surface": [
+ "#feb299",
+ "#df663c",
+ "#9b3407"
+ ],
+ "mesh": [
+ "#fcb864",
+ "#c08024",
+ "#7b5112"
+ ],
+ "form": [
+ "#fbaad9",
+ "#c46fa2",
+ "#893a6c"
+ ],
+ "sketch": [
+ "#d0cc73",
+ "#989439",
+ "#625e15"
+ ],
+ "constraint": [
+ "#fab3a8",
+ "#e85a4d",
+ "#a91714"
+ ],
+ "construction": [
+ "#feb299",
+ "#df663c",
+ "#9b3407"
+ ]
}
}
diff --git a/assets/styles/ui/themes/high-contrast.json b/assets/styles/ui/themes/high-contrast.json
index 9614ca3cec..f7b40c8aa6 100644
--- a/assets/styles/ui/themes/high-contrast.json
+++ b/assets/styles/ui/themes/high-contrast.json
@@ -30,7 +30,7 @@
"box_crossing": "#40e080",
"box_window": "#00bfff",
"chip": "#00bfff",
- "construction_geom": "#ffcc00",
+ "construction_geom": "#e6a019",
"construction_plane": "#ffcc0022",
"continuity": [
"#40e080",
@@ -54,25 +54,25 @@
"dimension_driven": "#cccccc",
"error": "#ff6666",
"field": "#000000",
- "form_accent": "#00bfff",
+ "form_accent": "#d98af9",
"form_dim": "#cccccc",
"form_error": "#ff6666",
"form_error_fill": "#331414",
- "form_fill": "#0070d0",
+ "form_fill": "#e6b2fc",
"form_ink": "#ffffff",
"form_primary": "#00bfff",
- "form_soft": "#002c45",
+ "form_soft": "#1b111f",
"form_success": "#40e080",
"form_success_fill": "#0b2616",
- "form_tab_ink": "#ffffff",
+ "form_tab_ink": "#df8fff",
"gizmo": [
"#ff6666",
"#40e080",
"#0070d0"
],
"glyph_bg": "#151515",
- "glyph_edge": "#ff6666",
- "glyph_text": "#ff6666",
+ "glyph_edge": "#fa8a86",
+ "glyph_text": "#fa8a86",
"grid": "#10202b",
"grid_major": "#234054",
"heading_bg": "#000000",
@@ -129,10 +129,10 @@
"#555555"
],
"manipulator": "#00bfff",
- "mesh_accent": "#00bfff",
- "mesh_fill": "#0070d0",
- "mesh_ink": "#ffffff",
- "mesh_soft": "#002c45",
+ "mesh_accent": "#b7b728",
+ "mesh_fill": "#d1d12d",
+ "mesh_ink": "#ffff00",
+ "mesh_soft": "#1f1f00",
"on_accent": "#06121b",
"origin_plane": "#ffcc0028",
"origin_plane_edge": "#ffcc0088",
@@ -146,10 +146,10 @@
"preview_new": "#ffcc00",
"preview_sketch": "#40e080",
"profile_fill": "#0070d022",
- "render_accent": "#00bfff",
- "render_fill": "#0070d0",
- "render_ink": "#ffffff",
- "render_soft": "#002c45",
+ "render_accent": "#fd7ebe",
+ "render_fill": "#fbaed2",
+ "render_ink": "#ff80c0",
+ "render_soft": "#1f0f17",
"rubber_band": "#00bfff",
"section_cap": "#ffcc00",
"sel_edge": "#00bfff",
@@ -160,26 +160,26 @@
"sel_vertex": "#0070d0",
"selected_bg": "#004c80",
"selected_ink": "#ffffff",
- "sheet_fill": "#0070d0",
- "sheet_ink": "#ffffff",
- "sheet_soft": "#002c45",
+ "sheet_fill": "#1fe5e5",
+ "sheet_ink": "#00ffff",
+ "sheet_soft": "#001f1f",
"sketch": "#0070d0",
- "sketch_accent": "#00bfff",
+ "sketch_accent": "#2cd06d",
"sketch_centerline": "#ffcc00",
"sketch_construction": "#ffcc00",
"sketch_fixed": "#ffffff",
- "sketch_ink": "#ffffff",
+ "sketch_ink": "#00ff80",
"sketch_locked": "#40e080",
"sketch_lost": "#ff6666",
"sketch_point": "#ffffff",
"sketch_point_free": "#0070d0",
"sketch_projected": "#c080ff",
- "sketch_soft": "#002c45",
+ "sketch_soft": "#001f0f",
"subheading_bg": "#060606",
- "surface_accent": "#00bfff",
- "surface_fill": "#0070d0",
- "surface_ink": "#ffffff",
- "surface_soft": "#002c45",
+ "surface_accent": "#e6a019",
+ "surface_fill": "#fcbc56",
+ "surface_ink": "#ffb000",
+ "surface_soft": "#1f1500",
"tab_on_fill_dark": "#000000",
"text": "#ffffff",
"text_dim": "#cccccc",
@@ -198,5 +198,48 @@
"warning": "#ffcc00"
},
"format": "solidcraft-theme/1",
- "name": "High Contrast"
+ "name": "High Contrast",
+ "icon_palette": {
+ "ink": "#000000",
+ "line": "#ffffff",
+ "passive-1": "#ffffff",
+ "passive-2": "#c0c0c0",
+ "passive-3": "#808080",
+ "guide": "#cccccc",
+ "solid": [
+ "#c9eafd",
+ "#8ad4fa",
+ "#00bfff"
+ ],
+ "surface": [
+ "#fedfb4",
+ "#fcbc56",
+ "#e6a019"
+ ],
+ "mesh": [
+ "#eeee31",
+ "#d1d12d",
+ "#b7b728"
+ ],
+ "form": [
+ "#f3dafe",
+ "#e6b2fc",
+ "#d98af9"
+ ],
+ "sketch": [
+ "#a4fdba",
+ "#32ee7e",
+ "#2cd06d"
+ ],
+ "constraint": [
+ "#fedbd9",
+ "#feb2ae",
+ "#fa8a86"
+ ],
+ "construction": [
+ "#fedfb4",
+ "#fcbc56",
+ "#e6a019"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/nord.json b/assets/styles/ui/themes/nord.json
index 3b0d1b817f..b9f056660a 100644
--- a/assets/styles/ui/themes/nord.json
+++ b/assets/styles/ui/themes/nord.json
@@ -30,7 +30,7 @@
"box_crossing": "#a3be8c",
"box_window": "#88c0d0",
"chip": "#88c0d0",
- "construction_geom": "#ebcb8b",
+ "construction_geom": "#eca089",
"construction_plane": "#ebcb8b22",
"continuity": [
"#a3be8c",
@@ -54,25 +54,25 @@
"dimension_driven": "#a4b0c2",
"error": "#bf616a",
"field": "#242933",
- "form_accent": "#88c0d0",
+ "form_accent": "#cfa7c7",
"form_dim": "#a4b0c2",
"form_error": "#bf616a",
"form_error_fill": "#4b3d48",
- "form_fill": "#5e81ac",
+ "form_fill": "#e7bfe0",
"form_ink": "#eceff4",
"form_primary": "#88c0d0",
- "form_soft": "#35495b",
+ "form_soft": "#3e3f4d",
"form_success": "#a3be8c",
"form_success_fill": "#424b4d",
- "form_tab_ink": "#eceff4",
+ "form_tab_ink": "#c3a5bd",
"gizmo": [
"#bf616a",
"#a3be8c",
"#5e81ac"
],
"glyph_bg": "#3b4252",
- "glyph_edge": "#bf616a",
- "glyph_text": "#bf616a",
+ "glyph_edge": "#f9959c",
+ "glyph_text": "#f9959c",
"grid": "#354051",
"grid_major": "#444f60",
"heading_bg": "#171a20",
@@ -129,10 +129,10 @@
"#657991"
],
"manipulator": "#88c0d0",
- "mesh_accent": "#88c0d0",
- "mesh_fill": "#5e81ac",
- "mesh_ink": "#eceff4",
- "mesh_soft": "#35495b",
+ "mesh_accent": "#d1b172",
+ "mesh_fill": "#e9c989",
+ "mesh_ink": "#ebcb8b",
+ "mesh_soft": "#454649",
"on_accent": "#06121b",
"origin_plane": "#ebcb8b28",
"origin_plane_edge": "#ebcb8b88",
@@ -146,10 +146,10 @@
"preview_new": "#ebcb8b",
"preview_sketch": "#a3be8c",
"profile_fill": "#5e81ac22",
- "render_accent": "#88c0d0",
- "render_fill": "#5e81ac",
- "render_ink": "#eceff4",
- "render_soft": "#35495b",
+ "render_accent": "#f9959c",
+ "render_fill": "#fdb9bd",
+ "render_ink": "#d5979d",
+ "render_soft": "#3f3945",
"rubber_band": "#88c0d0",
"section_cap": "#ebcb8b",
"sel_edge": "#5e81ac",
@@ -160,26 +160,26 @@
"sel_vertex": "#5e81ac",
"selected_bg": "#34607a",
"selected_ink": "#eceff4",
- "sheet_fill": "#5e81ac",
- "sheet_ink": "#eceff4",
- "sheet_soft": "#35495b",
+ "sheet_fill": "#aad8d7",
+ "sheet_ink": "#8fbcbb",
+ "sheet_soft": "#3a444f",
"sketch": "#5e81ac",
- "sketch_accent": "#88c0d0",
+ "sketch_accent": "#a5c08e",
"sketch_centerline": "#ebcb8b",
"sketch_construction": "#ebcb8b",
"sketch_fixed": "#eceff4",
- "sketch_ink": "#eceff4",
+ "sketch_ink": "#a3be8c",
"sketch_locked": "#a3be8c",
"sketch_lost": "#bf616a",
"sketch_point": "#eceff4",
"sketch_point_free": "#5e81ac",
"sketch_projected": "#b48ead",
- "sketch_soft": "#35495b",
+ "sketch_soft": "#3c4549",
"subheading_bg": "#222730",
- "surface_accent": "#88c0d0",
- "surface_fill": "#5e81ac",
- "surface_ink": "#eceff4",
- "surface_soft": "#35495b",
+ "surface_accent": "#eca089",
+ "surface_fill": "#fcbda9",
+ "surface_ink": "#d99e8b",
+ "surface_soft": "#413e46",
"tab_on_fill_dark": "#242933",
"text": "#eceff4",
"text_dim": "#a4b0c2",
@@ -198,5 +198,48 @@
"warning": "#ebcb8b"
},
"format": "solidcraft-theme/1",
- "name": "Nord"
+ "name": "Nord",
+ "icon_palette": {
+ "ink": "#242933",
+ "line": "#eceff4",
+ "passive-1": "#bdc1c8",
+ "passive-2": "#91959c",
+ "passive-3": "#686c72",
+ "guide": "#a4b0c2",
+ "solid": [
+ "#bbeefd",
+ "#a0d8e9",
+ "#88c0d0"
+ ],
+ "surface": [
+ "#fedcd1",
+ "#fcbda9",
+ "#eca089"
+ ],
+ "mesh": [
+ "#fee1a7",
+ "#e9c989",
+ "#d1b172"
+ ],
+ "form": [
+ "#ffd6f7",
+ "#e7bfe0",
+ "#cfa7c7"
+ ],
+ "sketch": [
+ "#d3f0bc",
+ "#bdd8a5",
+ "#a5c08e"
+ ],
+ "constraint": [
+ "#fddbdc",
+ "#fdb9bd",
+ "#f9959c"
+ ],
+ "construction": [
+ "#fedcd1",
+ "#fcbda9",
+ "#eca089"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/nosferatu.json b/assets/styles/ui/themes/nosferatu.json
index 634e78b2a8..5331931369 100644
--- a/assets/styles/ui/themes/nosferatu.json
+++ b/assets/styles/ui/themes/nosferatu.json
@@ -30,7 +30,7 @@
"box_crossing": "#50fa7b",
"box_window": "#bd93f9",
"chip": "#bd93f9",
- "construction_geom": "#f1fa8c",
+ "construction_geom": "#e09b4e",
"construction_plane": "#f1fa8c22",
"continuity": [
"#50fa7b",
@@ -54,25 +54,25 @@
"dimension_driven": "#a1a4c4",
"error": "#ff5555",
"field": "#21222c",
- "form_accent": "#bd93f9",
+ "form_accent": "#c096e8",
"form_dim": "#a1a4c4",
"form_error": "#ff5555",
"form_error_fill": "#53333c",
- "form_fill": "#8456b8",
+ "form_fill": "#d7b2fd",
"form_ink": "#f8f8f2",
"form_primary": "#bd93f9",
- "form_soft": "#393149",
+ "form_soft": "#3d3a4e",
"form_success": "#50fa7b",
"form_success_fill": "#2f4d42",
- "form_tab_ink": "#f8f8f2",
+ "form_tab_ink": "#d6acff",
"gizmo": [
"#ff5555",
"#50fa7b",
"#8456b8"
],
"glyph_bg": "#343746",
- "glyph_edge": "#ff5555",
- "glyph_text": "#ff5555",
+ "glyph_edge": "#fc827b",
+ "glyph_text": "#fc827b",
"grid": "#2e2f3d",
"grid_major": "#3e4050",
"heading_bg": "#14151b",
@@ -129,10 +129,10 @@
"#656581"
],
"manipulator": "#bd93f9",
- "mesh_accent": "#bd93f9",
- "mesh_fill": "#8456b8",
- "mesh_ink": "#f8f8f2",
- "mesh_soft": "#393149",
+ "mesh_accent": "#adb445",
+ "mesh_fill": "#c6ce60",
+ "mesh_ink": "#f1fa8c",
+ "mesh_soft": "#404340",
"on_accent": "#06121b",
"origin_plane": "#f1fa8c28",
"origin_plane_edge": "#f1fa8c88",
@@ -146,10 +146,10 @@
"preview_new": "#f1fa8c",
"preview_sketch": "#50fa7b",
"profile_fill": "#8456b822",
- "render_accent": "#bd93f9",
- "render_fill": "#8456b8",
- "render_ink": "#f8f8f2",
- "render_soft": "#393149",
+ "render_accent": "#fb75c2",
+ "render_fill": "#fea4d4",
+ "render_ink": "#ff79c6",
+ "render_soft": "#423347",
"rubber_band": "#bd93f9",
"section_cap": "#f1fa8c",
"sel_edge": "#8456b8",
@@ -160,26 +160,26 @@
"sel_vertex": "#8456b8",
"selected_bg": "#563c79",
"selected_ink": "#f8f8f2",
- "sheet_fill": "#8456b8",
- "sheet_ink": "#f8f8f2",
- "sheet_soft": "#393149",
+ "sheet_fill": "#77d5e9",
+ "sheet_ink": "#8be9fd",
+ "sheet_soft": "#34414e",
"sketch": "#8456b8",
- "sketch_accent": "#bd93f9",
+ "sketch_accent": "#31cc5d",
"sketch_centerline": "#f1fa8c",
"sketch_construction": "#f1fa8c",
"sketch_fixed": "#f8f8f2",
- "sketch_ink": "#f8f8f2",
+ "sketch_ink": "#50fa7b",
"sketch_locked": "#50fa7b",
"sketch_lost": "#ff5555",
"sketch_point": "#f8f8f2",
"sketch_point_free": "#8456b8",
"sketch_projected": "#bd93f9",
- "sketch_soft": "#393149",
+ "sketch_soft": "#2d433e",
"subheading_bg": "#1e2028",
- "surface_accent": "#bd93f9",
- "surface_fill": "#8456b8",
- "surface_ink": "#f8f8f2",
- "surface_soft": "#393149",
+ "surface_accent": "#e09b4e",
+ "surface_fill": "#fbb468",
+ "surface_ink": "#ffb86c",
+ "surface_soft": "#423b3c",
"tab_on_fill_dark": "#21222c",
"text": "#f8f8f2",
"text_dim": "#a1a4c4",
@@ -198,5 +198,48 @@
"warning": "#f1fa8c"
},
"format": "solidcraft-theme/1",
- "name": "Nosferatu"
+ "name": "Nosferatu",
+ "icon_palette": {
+ "ink": "#21222c",
+ "line": "#f8f8f2",
+ "passive-1": "#bfc0cb",
+ "passive-2": "#93949f",
+ "passive-3": "#6a6b75",
+ "guide": "#a1a4c4",
+ "solid": [
+ "#e7dbfd",
+ "#d0b6fa",
+ "#bd93f9"
+ ],
+ "surface": [
+ "#fedbb9",
+ "#fbb468",
+ "#e09b4e"
+ ],
+ "mesh": [
+ "#e3eb7e",
+ "#c6ce60",
+ "#adb445"
+ ],
+ "form": [
+ "#ebd9fe",
+ "#d7b2fd",
+ "#c096e8"
+ ],
+ "sketch": [
+ "#92ffa4",
+ "#38e96b",
+ "#31cc5d"
+ ],
+ "constraint": [
+ "#fdd8d4",
+ "#ffaca5",
+ "#fc827b"
+ ],
+ "construction": [
+ "#fedbb9",
+ "#fbb468",
+ "#e09b4e"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/one-dark.json b/assets/styles/ui/themes/one-dark.json
index 026fe1fcdf..bd8a2be038 100644
--- a/assets/styles/ui/themes/one-dark.json
+++ b/assets/styles/ui/themes/one-dark.json
@@ -30,7 +30,7 @@
"box_crossing": "#98c379",
"box_window": "#61afef",
"chip": "#344b65",
- "construction_geom": "#d19a66",
+ "construction_geom": "#d29b67",
"construction_plane": "#d0996646",
"continuity": [
"#98c379",
@@ -54,25 +54,25 @@
"dimension_driven": "#7f848e",
"error": "#e06c75",
"field": "#1e2227",
- "form_accent": "#7b63a6",
+ "form_accent": "#d283e9",
"form_dim": "#949ba8",
"form_error": "#f06460",
"form_error_fill": "#6e3236",
- "form_fill": "#8a6fcc",
+ "form_fill": "#e9a1fe",
"form_ink": "#dee2e8",
"form_primary": "#3a88ee",
- "form_soft": "#372f4f",
+ "form_soft": "#352f40",
"form_success": "#8fdb9a",
"form_success_fill": "#2c4a33",
- "form_tab_ink": "#b39bee",
+ "form_tab_ink": "#c97fdf",
"gizmo": [
"#e06c75",
"#98c379",
"#61afef"
],
"glyph_bg": "#282c34",
- "glyph_edge": "#e06c75",
- "glyph_text": "#e06c75",
+ "glyph_edge": "#f57f87",
+ "glyph_text": "#f57f87",
"grid": "#323842",
"grid_major": "#3e4451",
"heading_bg": "#14161a",
@@ -129,10 +129,10 @@
"#c678dd"
],
"manipulator": "#61afef",
- "mesh_accent": "#857100",
- "mesh_fill": "#c6a800",
- "mesh_ink": "#d4b726",
- "mesh_soft": "#41391a",
+ "mesh_accent": "#c6a25e",
+ "mesh_fill": "#e0bb76",
+ "mesh_ink": "#e5c07b",
+ "mesh_soft": "#393835",
"on_accent": "#ffffff",
"origin_plane": "#d19b675e",
"origin_plane_edge": "#d19a66c8",
@@ -146,10 +146,10 @@
"preview_new": "#e5c07b",
"preview_sketch": "#98c379",
"profile_fill": "#60acec28",
- "render_accent": "#e074ae",
- "render_fill": "#c8588f",
- "render_ink": "#e074ae",
- "render_soft": "#402336",
+ "render_accent": "#f57f87",
+ "render_fill": "#fea5a9",
+ "render_ink": "#e37b83",
+ "render_soft": "#382e34",
"rubber_band": "#61afef",
"section_cap": "#d19a66",
"sel_edge": "#61afef",
@@ -160,26 +160,26 @@
"sel_vertex": "#61afef",
"selected_bg": "#2a466e",
"selected_ink": "#9cc7f5",
- "sheet_fill": "#2a7fa8",
- "sheet_ink": "#4fb3d9",
- "sheet_soft": "#1f3a47",
+ "sheet_fill": "#73d2de",
+ "sheet_ink": "#56b6c2",
+ "sheet_soft": "#27363d",
"sketch": "#61afef",
- "sketch_accent": "#56b6c2",
+ "sketch_accent": "#8cb76d",
"sketch_centerline": "#d19a66",
"sketch_construction": "#d19a66",
"sketch_fixed": "#abb2bf",
- "sketch_ink": "#46be78",
+ "sketch_ink": "#98c379",
"sketch_locked": "#98c379",
"sketch_lost": "#e06c75",
"sketch_point": "#abb2bf",
"sketch_point_free": "#61afef",
"sketch_projected": "#c678dd",
- "sketch_soft": "#1f3b2b",
+ "sketch_soft": "#2f3834",
"subheading_bg": "#1e2127",
- "surface_accent": "#95682d",
- "surface_fill": "#b26a14",
- "surface_ink": "#e0914a",
- "surface_soft": "#45331e",
+ "surface_accent": "#d29b67",
+ "surface_fill": "#edb47f",
+ "surface_ink": "#d19a66",
+ "surface_soft": "#363332",
"tab_on_fill_dark": "#000000",
"text": "#abb2bf",
"text_dim": "#7f848e",
@@ -198,5 +198,48 @@
"warning": "#e5c07b"
},
"format": "solidcraft-theme/1",
- "name": "One Dark"
+ "name": "One Dark",
+ "icon_palette": {
+ "ink": "#21252b",
+ "line": "#abb2bf",
+ "passive-1": "#bec1c6",
+ "passive-2": "#93959a",
+ "passive-3": "#696c70",
+ "guide": "#7f848e",
+ "solid": [
+ "#c5e2fc",
+ "#8ac8fd",
+ "#61afef"
+ ],
+ "surface": [
+ "#fcd6b4",
+ "#edb47f",
+ "#d29b67"
+ ],
+ "mesh": [
+ "#fed993",
+ "#e0bb76",
+ "#c6a25e"
+ ],
+ "form": [
+ "#f2d0fd",
+ "#e9a1fe",
+ "#d283e9"
+ ],
+ "sketch": [
+ "#c2eea2",
+ "#a5d186",
+ "#8cb76d"
+ ],
+ "constraint": [
+ "#fed1d2",
+ "#fea5a9",
+ "#f57f87"
+ ],
+ "construction": [
+ "#fcd6b4",
+ "#edb47f",
+ "#d29b67"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/platinum-9.json b/assets/styles/ui/themes/platinum-9.json
index ab843ef51f..68bf60fae8 100644
--- a/assets/styles/ui/themes/platinum-9.json
+++ b/assets/styles/ui/themes/platinum-9.json
@@ -30,7 +30,7 @@
"box_crossing": "#28a050",
"box_window": "#555599",
"chip": "#555599",
- "construction_geom": "#9c5600",
+ "construction_geom": "#785735",
"construction_plane": "#ccccdd33",
"continuity": [
"#009e73",
@@ -54,25 +54,25 @@
"dimension_driven": "#666666",
"error": "#bb3333",
"field": "#ffffff",
- "form_accent": "#666699",
+ "form_accent": "#704e81",
"form_dim": "#666666",
"form_error": "#aa2222",
"form_error_fill": "#f2dddd",
- "form_fill": "#8888bb",
+ "form_fill": "#a783b9",
"form_ink": "#444477",
"form_primary": "#555599",
- "form_soft": "#e6e6f2",
+ "form_soft": "#d5d2d6",
"form_success": "#336633",
"form_success_fill": "#e2ecdf",
- "form_tab_ink": "#555599",
+ "form_tab_ink": "#6d4e7d",
"gizmo": [
"#e1463c",
"#50be50",
"#4682f0"
],
"glyph_bg": "#ffffff",
- "glyph_edge": "#be6e64",
- "glyph_text": "#ca473d",
+ "glyph_edge": "#ab2125",
+ "glyph_text": "#ab2125",
"grid": "#e2e2e2",
"grid_major": "#c8c8c8",
"heading_bg": "#cccccc",
@@ -129,10 +129,10 @@
"#666699"
],
"manipulator": "#555599",
- "mesh_accent": "#666699",
- "mesh_fill": "#8888bb",
- "mesh_ink": "#444477",
- "mesh_soft": "#e6e6f2",
+ "mesh_accent": "#6d5d2a",
+ "mesh_fill": "#a3925e",
+ "mesh_ink": "#675a34",
+ "mesh_soft": "#d6d5d1",
"on_accent": "#ffffff",
"origin_plane": "#ccccdd44",
"origin_plane_edge": "#888899aa",
@@ -146,10 +146,10 @@
"preview_new": "#f0e169",
"preview_sketch": "#20be60",
"profile_fill": "#ccccff33",
- "render_accent": "#666699",
- "render_fill": "#8888bb",
- "render_ink": "#444477",
- "render_soft": "#e6e6f2",
+ "render_accent": "#913d5f",
+ "render_fill": "#cc7294",
+ "render_ink": "#8e3f5f",
+ "render_soft": "#d8d1d3",
"rubber_band": "#555599",
"section_cap": "#d68048",
"sel_edge": "#555599",
@@ -160,26 +160,26 @@
"sel_vertex": "#555599",
"selected_bg": "#ccccff",
"selected_ink": "#333366",
- "sheet_fill": "#8888bb",
- "sheet_ink": "#444477",
- "sheet_soft": "#e6e6f2",
+ "sheet_fill": "#6a9e9e",
+ "sheet_ink": "#376060",
+ "sheet_soft": "#d1d5d5",
"sketch": "#444488",
- "sketch_accent": "#666699",
+ "sketch_accent": "#476847",
"sketch_centerline": "#c86e3c",
"sketch_construction": "#e68228",
"sketch_fixed": "#222222",
- "sketch_ink": "#444477",
+ "sketch_ink": "#456045",
"sketch_locked": "#447744",
"sketch_lost": "#c83c5a",
"sketch_point": "#222222",
"sketch_point_free": "#444488",
"sketch_projected": "#963cbe",
- "sketch_soft": "#e6e6f2",
+ "sketch_soft": "#d2d5d2",
"subheading_bg": "#d7d7d7",
- "surface_accent": "#666699",
- "surface_fill": "#8888bb",
- "surface_ink": "#444477",
- "surface_soft": "#e6e6f2",
+ "surface_accent": "#785735",
+ "surface_fill": "#af8b68",
+ "surface_ink": "#715538",
+ "surface_soft": "#d6d3d1",
"tab_on_fill_dark": "#222222",
"text": "#222222",
"text_dim": "#666666",
@@ -198,5 +198,56 @@
"warning": "#997722"
},
"format": "solidcraft-theme/1",
- "name": "Platinum 9"
+ "name": "Platinum 9",
+ "radii": {
+ "radius_sm": 0,
+ "radius_md": 0,
+ "radius_lg": 0,
+ "radius_xl": 0,
+ "control_radius": 0,
+ "sketch_mode_radius": 0
+ },
+ "icon_palette": {
+ "ink": "#222222",
+ "line": "#222222",
+ "passive-1": "#e2e3f7",
+ "passive-2": "#b1b2c6",
+ "passive-3": "#838497",
+ "guide": "#666666",
+ "solid": [
+ "#bfc3fb",
+ "#888ad3",
+ "#555599"
+ ],
+ "surface": [
+ "#e6c09c",
+ "#af8b68",
+ "#785735"
+ ],
+ "mesh": [
+ "#d9c792",
+ "#a3925e",
+ "#6d5d2a"
+ ],
+ "form": [
+ "#ddb7f1",
+ "#a783b9",
+ "#704e81"
+ ],
+ "sketch": [
+ "#afd4ae",
+ "#7a9e7a",
+ "#476847"
+ ],
+ "constraint": [
+ "#ffb1aa",
+ "#ea5f5a",
+ "#ab2125"
+ ],
+ "construction": [
+ "#e6c09c",
+ "#af8b68",
+ "#785735"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/solarized-light.json b/assets/styles/ui/themes/solarized-light.json
index eab4c8c5cb..87e696a8f0 100644
--- a/assets/styles/ui/themes/solarized-light.json
+++ b/assets/styles/ui/themes/solarized-light.json
@@ -30,7 +30,7 @@
"box_crossing": "#859900",
"box_window": "#268bd2",
"chip": "#268bd2",
- "construction_geom": "#b58900",
+ "construction_geom": "#cb4b16",
"construction_plane": "#b5890022",
"continuity": [
"#859900",
@@ -54,25 +54,25 @@
"dimension_driven": "#657b83",
"error": "#dc322f",
"field": "#fdf6e3",
- "form_accent": "#268bd2",
+ "form_accent": "#6b70c3",
"form_dim": "#657b83",
"form_error": "#dc322f",
"form_error_fill": "#eac4b4",
- "form_fill": "#346e88",
+ "form_fill": "#a2a9f8",
"form_ink": "#586e75",
"form_primary": "#268bd2",
- "form_soft": "#e1e8d9",
+ "form_soft": "#e4ded4",
"form_success": "#859900",
"form_success_fill": "#dcdbb1",
- "form_tab_ink": "#346e88",
+ "form_tab_ink": "#565a9d",
"gizmo": [
"#dc322f",
"#859900",
"#346e88"
],
"glyph_bg": "#e3ddc9",
- "glyph_edge": "#dc322f",
- "glyph_text": "#dc322f",
+ "glyph_edge": "#da2f2d",
+ "glyph_text": "#da2f2d",
"grid": "#dfddd0",
"grid_major": "#c8cbc1",
"heading_bg": "#e3ddc9",
@@ -129,10 +129,10 @@
"#b5b6a0"
],
"manipulator": "#268bd2",
- "mesh_accent": "#268bd2",
- "mesh_fill": "#346e88",
- "mesh_ink": "#586e75",
- "mesh_soft": "#e1e8d9",
+ "mesh_accent": "#97751d",
+ "mesh_fill": "#d7aa3c",
+ "mesh_ink": "#7b5d00",
+ "mesh_soft": "#e9e0c4",
"on_accent": "#ffffff",
"origin_plane": "#b5890028",
"origin_plane_edge": "#b5890088",
@@ -146,10 +146,10 @@
"preview_new": "#b58900",
"preview_sketch": "#859900",
"profile_fill": "#346e8822",
- "render_accent": "#268bd2",
- "render_fill": "#346e88",
- "render_ink": "#586e75",
- "render_soft": "#e1e8d9",
+ "render_accent": "#cf317e",
+ "render_fill": "#f986b4",
+ "render_ink": "#ad2c6b",
+ "render_soft": "#ecdace",
"rubber_band": "#268bd2",
"section_cap": "#b58900",
"sel_edge": "#346e88",
@@ -160,26 +160,26 @@
"sel_vertex": "#346e88",
"selected_bg": "#bdd9da",
"selected_ink": "#234a55",
- "sheet_fill": "#346e88",
- "sheet_ink": "#586e75",
- "sheet_soft": "#e1e8d9",
+ "sheet_fill": "#58c6bc",
+ "sheet_ink": "#1d6d67",
+ "sheet_soft": "#dee2d0",
"sketch": "#346e88",
- "sketch_accent": "#268bd2",
+ "sketch_accent": "#738400",
"sketch_centerline": "#b58900",
"sketch_construction": "#b58900",
"sketch_fixed": "#586e75",
- "sketch_ink": "#586e75",
+ "sketch_ink": "#5a6800",
"sketch_locked": "#859900",
"sketch_lost": "#dc322f",
"sketch_point": "#586e75",
"sketch_point_free": "#346e88",
"sketch_projected": "#6c71c4",
- "sketch_soft": "#e1e8d9",
+ "sketch_soft": "#e6e2c4",
"subheading_bg": "#eae4d1",
- "surface_accent": "#268bd2",
- "surface_fill": "#346e88",
- "surface_ink": "#586e75",
- "surface_soft": "#e1e8d9",
+ "surface_accent": "#cb4b16",
+ "surface_fill": "#fb906b",
+ "surface_ink": "#a83e12",
+ "surface_soft": "#ebdbc6",
"tab_on_fill_dark": "#fdf6e3",
"text": "#586e75",
"text_dim": "#657b83",
@@ -198,5 +198,48 @@
"warning": "#b58900"
},
"format": "solidcraft-theme/1",
- "name": "Solarized Light"
+ "name": "Solarized Light",
+ "icon_palette": {
+ "ink": "#151515",
+ "line": "#586e75",
+ "passive-1": "#dee6e9",
+ "passive-2": "#aeb6b9",
+ "passive-3": "#80888a",
+ "guide": "#657b83",
+ "solid": [
+ "#d5ebff",
+ "#67b9fb",
+ "#1480c6"
+ ],
+ "surface": [
+ "#fee1d7",
+ "#fb906b",
+ "#cb4b16"
+ ],
+ "mesh": [
+ "#fde5b2",
+ "#d7aa3c",
+ "#97751d"
+ ],
+ "form": [
+ "#e3e6fe",
+ "#a2a9f8",
+ "#6b70c3"
+ ],
+ "sketch": [
+ "#def67b",
+ "#a8be40",
+ "#738400"
+ ],
+ "constraint": [
+ "#fee0dc",
+ "#fb8d81",
+ "#da2f2d"
+ ],
+ "construction": [
+ "#fee1d7",
+ "#fb906b",
+ "#cb4b16"
+ ]
+ }
}
diff --git a/assets/styles/ui/themes/solidcraft-95.json b/assets/styles/ui/themes/solidcraft-95.json
index 29b442b382..f60abdc1e6 100644
--- a/assets/styles/ui/themes/solidcraft-95.json
+++ b/assets/styles/ui/themes/solidcraft-95.json
@@ -55,16 +55,16 @@
"error": "#ff0000",
"field": "#ffffff",
"form_accent": "#800080",
- "form_dim": "#808080",
+ "form_dim": "#404040",
"form_error": "#800000",
"form_error_fill": "#ffffc0",
"form_fill": "#800080",
"form_ink": "#000000",
"form_primary": "#000080",
- "form_soft": "#c0c0c0",
+ "form_soft": "#bbb1bb",
"form_success": "#008000",
"form_success_fill": "#c0dcc0",
- "form_tab_ink": "#800080",
+ "form_tab_ink": "#7d007d",
"gizmo": [
"#ff0000",
"#00ff00",
@@ -75,8 +75,8 @@
"glyph_text": "#800000",
"grid": "#40a0a0",
"grid_major": "#808080",
- "heading_bg": "#a0a0a0",
- "hover": "#c0c0c0",
+ "heading_bg": "#c0c0c0",
+ "hover": "#dfdfdf",
"hover_edge": "#000000",
"hover_edge_halo": "#ffffff",
"hover_profile": "#00008030",
@@ -129,10 +129,10 @@
"#808080"
],
"manipulator": "#000080",
- "mesh_accent": "#000080",
+ "mesh_accent": "#808000",
"mesh_fill": "#808000",
- "mesh_ink": "#808000",
- "mesh_soft": "#ffffc0",
+ "mesh_ink": "#4c4c00",
+ "mesh_soft": "#bbbbb1",
"on_accent": "#ffffff",
"origin_plane": "#ffff005e",
"origin_plane_edge": "#808000c8",
@@ -146,10 +146,10 @@
"preview_new": "#ffff00",
"preview_sketch": "#008000",
"profile_fill": "#ffff0033",
- "render_accent": "#000080",
- "render_fill": "#800080",
- "render_ink": "#800080",
- "render_soft": "#c0c0c0",
+ "render_accent": "#590905",
+ "render_fill": "#800000",
+ "render_ink": "#800000",
+ "render_soft": "#bbb1b1",
"rubber_band": "#000080",
"section_cap": "#808000",
"sel_edge": "#0000ff",
@@ -161,25 +161,25 @@
"selected_bg": "#000080",
"selected_ink": "#ffffff",
"sheet_fill": "#008080",
- "sheet_ink": "#000080",
- "sheet_soft": "#c0c0c0",
+ "sheet_ink": "#005151",
+ "sheet_soft": "#b1bbbb",
"sketch": "#000080",
"sketch_accent": "#008000",
"sketch_centerline": "#808000",
"sketch_construction": "#808000",
"sketch_fixed": "#000000",
- "sketch_ink": "#008000",
+ "sketch_ink": "#005400",
"sketch_locked": "#008000",
"sketch_lost": "#800080",
"sketch_point": "#000000",
"sketch_point_free": "#000080",
"sketch_projected": "#800080",
- "sketch_soft": "#c0dcc0",
- "subheading_bg": "#b0b0b0",
- "surface_accent": "#000080",
- "surface_fill": "#808000",
- "surface_ink": "#808000",
- "surface_soft": "#ffffc0",
+ "sketch_soft": "#b1bbb1",
+ "subheading_bg": "#c0c0c0",
+ "surface_accent": "#804000",
+ "surface_fill": "#804000",
+ "surface_ink": "#713800",
+ "surface_soft": "#bbb6b1",
"tab_on_fill_dark": "#000000",
"text": "#000000",
"text_dim": "#808080",
@@ -198,5 +198,85 @@
"warning": "#ffff00"
},
"format": "solidcraft-theme/1",
- "name": "SolidCraft 95"
+ "name": "SolidCraft 95",
+ "radii": {
+ "radius_sm": 3,
+ "radius_md": 3,
+ "radius_lg": 4,
+ "radius_xl": 4,
+ "control_radius": 3,
+ "sketch_mode_radius": 3
+ },
+ "icon_palette": {
+ "ink": "#000000",
+ "line": "#000000",
+ "passive-1": "#ffffff",
+ "passive-2": "#c0c0c0",
+ "passive-3": "#808080",
+ "guide": "#696969",
+ "solid": [
+ "#c0c0ff",
+ "#0000ff",
+ "#000080"
+ ],
+ "surface": [
+ "#e0c0a0",
+ "#b07040",
+ "#804000"
+ ],
+ "mesh": [
+ "#ffffc0",
+ "#c0c000",
+ "#808000"
+ ],
+ "form": [
+ "#ffc0ff",
+ "#c000c0",
+ "#800080"
+ ],
+ "sketch": [
+ "#c0ffc0",
+ "#00c000",
+ "#008000"
+ ],
+ "constraint": [
+ "#ffc0c0",
+ "#ff0000",
+ "#800000"
+ ],
+ "construction": [
+ "#ffffc0",
+ "#c0c000",
+ "#808000"
+ ]
+ },
+ "borders": {
+ "primary": {
+ "width": 1,
+ "color": "#404040"
+ },
+ "secondary": {
+ "width": 1,
+ "color": "#808080"
+ },
+ "tertiary": {
+ "width": 1,
+ "color": "#a0a0a0"
+ },
+ "container": {
+ "width": 1,
+ "color": "#808080"
+ },
+ "control": {
+ "width": 1,
+ "color": "#808080"
+ },
+ "bevel": {
+ "width": 0.5,
+ "highlight": "#ffffff",
+ "light": "#dfdfdf",
+ "shadow": "#808080",
+ "dark_shadow": "#000000"
+ }
+ }
}
diff --git a/assets/styles/ui/themes/tokyo-night.json b/assets/styles/ui/themes/tokyo-night.json
index 7bff6a50a3..bc371b5d5e 100644
--- a/assets/styles/ui/themes/tokyo-night.json
+++ b/assets/styles/ui/themes/tokyo-night.json
@@ -30,7 +30,7 @@
"box_crossing": "#9ece6a",
"box_window": "#7aa2f7",
"chip": "#7aa2f7",
- "construction_geom": "#e0af68",
+ "construction_geom": "#e7894e",
"construction_plane": "#e0af6822",
"continuity": [
"#9ece6a",
@@ -54,25 +54,25 @@
"dimension_driven": "#9aa5ce",
"error": "#f7768e",
"field": "#16161e",
- "form_accent": "#7aa2f7",
+ "form_accent": "#b190ec",
"form_dim": "#9aa5ce",
"form_error": "#f7768e",
"form_error_fill": "#462d3b",
- "form_fill": "#4775ce",
+ "form_fill": "#c7aefa",
"form_ink": "#c0caf5",
"form_primary": "#7aa2f7",
- "form_soft": "#253452",
+ "form_soft": "#2d2a3f",
"form_success": "#9ece6a",
"form_success_fill": "#303932",
- "form_tab_ink": "#c0caf5",
+ "form_tab_ink": "#bb9af7",
"gizmo": [
"#f7768e",
"#9ece6a",
"#4775ce"
],
"glyph_bg": "#24283b",
- "glyph_edge": "#f7768e",
- "glyph_text": "#f7768e",
+ "glyph_edge": "#f6758d",
+ "glyph_text": "#f6758d",
"grid": "#262938",
"grid_major": "#363a4d",
"heading_bg": "#0d0e13",
@@ -129,10 +129,10 @@
"#4f6089"
],
"manipulator": "#7aa2f7",
- "mesh_accent": "#7aa2f7",
- "mesh_fill": "#4775ce",
- "mesh_ink": "#c0caf5",
- "mesh_soft": "#253452",
+ "mesh_accent": "#cb9b54",
+ "mesh_fill": "#e5b46d",
+ "mesh_ink": "#e0af68",
+ "mesh_soft": "#322d2e",
"on_accent": "#06121b",
"origin_plane": "#e0af6828",
"origin_plane_edge": "#e0af6888",
@@ -146,10 +146,10 @@
"preview_new": "#e0af68",
"preview_sketch": "#9ece6a",
"profile_fill": "#4775ce22",
- "render_accent": "#7aa2f7",
- "render_fill": "#4775ce",
- "render_ink": "#c0caf5",
- "render_soft": "#253452",
+ "render_accent": "#f6758d",
+ "render_fill": "#fe9dac",
+ "render_ink": "#f7768e",
+ "render_soft": "#352632",
"rubber_band": "#7aa2f7",
"section_cap": "#e0af68",
"sel_edge": "#4775ce",
@@ -160,26 +160,26 @@
"sel_vertex": "#4775ce",
"selected_bg": "#304e7e",
"selected_ink": "#c0caf5",
- "sheet_fill": "#4775ce",
- "sheet_ink": "#c0caf5",
- "sheet_soft": "#253452",
+ "sheet_fill": "#76c8f8",
+ "sheet_ink": "#7dcfff",
+ "sheet_soft": "#263140",
"sketch": "#4775ce",
- "sketch_accent": "#7aa2f7",
+ "sketch_accent": "#87b552",
"sketch_centerline": "#e0af68",
"sketch_construction": "#e0af68",
"sketch_fixed": "#c0caf5",
- "sketch_ink": "#c0caf5",
+ "sketch_ink": "#9ece6a",
"sketch_locked": "#9ece6a",
"sketch_lost": "#f7768e",
"sketch_point": "#c0caf5",
"sketch_point_free": "#4775ce",
"sketch_projected": "#bb9af7",
- "sketch_soft": "#253452",
+ "sketch_soft": "#2a302e",
"subheading_bg": "#14141c",
- "surface_accent": "#7aa2f7",
- "surface_fill": "#4775ce",
- "surface_ink": "#c0caf5",
- "surface_soft": "#253452",
+ "surface_accent": "#e7894e",
+ "surface_fill": "#fda572",
+ "surface_ink": "#ff9e64",
+ "surface_soft": "#352b2d",
"tab_on_fill_dark": "#16161e",
"text": "#c0caf5",
"text_dim": "#9aa5ce",
@@ -198,5 +198,48 @@
"warning": "#e0af68"
},
"format": "solidcraft-theme/1",
- "name": "Tokyo Night"
+ "name": "Tokyo Night",
+ "icon_palette": {
+ "ink": "#16161e",
+ "line": "#c0caf5",
+ "passive-1": "#bcc0cf",
+ "passive-2": "#9195a3",
+ "passive-3": "#676b79",
+ "guide": "#9aa5ce",
+ "solid": [
+ "#cadbfd",
+ "#9ebdfc",
+ "#7aa2f7"
+ ],
+ "surface": [
+ "#fcd0b8",
+ "#fda572",
+ "#e7894e"
+ ],
+ "mesh": [
+ "#fcd39b",
+ "#e5b46d",
+ "#cb9b54"
+ ],
+ "form": [
+ "#e0d3fc",
+ "#c7aefa",
+ "#b190ec"
+ ],
+ "sketch": [
+ "#bced88",
+ "#9fcf6b",
+ "#87b552"
+ ],
+ "constraint": [
+ "#fdccd2",
+ "#fe9dac",
+ "#f6758d"
+ ],
+ "construction": [
+ "#fcd0b8",
+ "#fda572",
+ "#e7894e"
+ ]
+ }
}
diff --git a/crates/ui-egui/src/agent_chat/markdown_view.rs b/crates/ui-egui/src/agent_chat/markdown_view.rs
index 8c6d6da585..4b8dfed147 100644
--- a/crates/ui-egui/src/agent_chat/markdown_view.rs
+++ b/crates/ui-egui/src/agent_chat/markdown_view.rs
@@ -94,7 +94,7 @@ pub fn show(ui: &mut egui::Ui, slot: usize, src: &str) {
ui.add(egui::Label::new(RichText::new(markdown::plain(s)).size(size).semibold().color(t.text)).selectable(true).wrap());
}
Block::Code { text, .. } => {
- egui::Frame::NONE.fill(t.field).corner_radius(4.0).inner_margin(Margin::same(6)).show(ui, |ui| {
+ egui::Frame::NONE.fill(t.field).corner_radius(t.radius_sm).inner_margin(Margin::same(6)).show(ui, |ui| {
ui.set_width(ui.available_width());
ui.add(
egui::Label::new(RichText::new(text).monospace().size(size - (t.font_button - t.font_body)).color(t.text))
@@ -118,7 +118,7 @@ pub fn show(ui: &mut egui::Ui, slot: usize, src: &str) {
Block::Quote(s) => {
ui.horizontal_top(|ui| {
let (bar, _) = ui.allocate_exact_size(vec2(3.0, 16.0), egui::Sense::hover());
- ui.painter().rect_filled(bar, 1.0, t.border);
+ ui.painter().rect_filled(bar, t.radius_sm / 4, t.border);
ui.vertical(|ui| spans(ui, s, size, t.text_dim));
});
}
diff --git a/crates/ui-egui/src/agent_chat/panel.rs b/crates/ui-egui/src/agent_chat/panel.rs
index 2039db34d9..7d58ad5f89 100644
--- a/crates/ui-egui/src/agent_chat/panel.rs
+++ b/crates/ui-egui/src/agent_chat/panel.rs
@@ -265,11 +265,11 @@ fn picture_strip(ui: &mut egui::Ui, n: usize, pictures: &[Picture]) -> Option<us
}
};
let size = fit(texture.size_vec2(), vec2(THUMB_MAX.0, THUMB_MAX.1));
- let thumb = ui.add(egui::Image::new((texture.id(), size)).corner_radius(4.0).sense(Sense::click()));
+ let thumb = ui.add(egui::Image::new((texture.id(), size)).corner_radius(t.radius_sm).sense(Sense::click()));
crate::scenario::publish_handle(&format!("agent_chat:picture:{n}:{i}"), thumb.rect.center());
let hover_max = (ui.ctx().content_rect().size() * 0.5).min(vec2(PREVIEW_MAX.0, PREVIEW_MAX.1));
let thumb = thumb.on_hover_cursor(egui::CursorIcon::PointingHand).on_hover_ui(|ui| {
- ui.add(egui::Image::new((texture.id(), fit(texture.size_vec2(), hover_max))).corner_radius(4.0));
+ ui.add(egui::Image::new((texture.id(), fit(texture.size_vec2(), hover_max))).corner_radius(t.radius_sm));
if !picture.note.is_empty() {
ui.label(&picture.note);
}
@@ -319,7 +319,7 @@ fn gallery_window(app: &mut SolveApp, ctx: &egui::Context) {
if let Some(picture) = gallery.pictures.get(gallery.at) {
match picture.texture(ui.ctx()) {
Shown::Ready(texture) => {
- let resp = ui.add(egui::Image::new((texture.id(), fit(texture.size_vec2(), max))).corner_radius(4.0));
+ let resp = ui.add(egui::Image::new((texture.id(), fit(texture.size_vec2(), max))).corner_radius(t.radius_sm));
crate::scenario::publish_rect("agent_chat:gallery_picture", resp.rect);
}
Shown::Loading => {
@@ -361,7 +361,7 @@ fn drop_hint(ctx: &egui::Context, area: Rect) {
let t = Tokens::get();
let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, Id::new("sc_agent_chat_drop_hint")));
let zone = area.shrink(6.0);
- painter.rect(zone, 10.0, t.accent.gamma_multiply(0.16), Stroke::new(2.0, t.accent), egui::StrokeKind::Inside);
+ painter.rect(zone, t.radius_xl, t.accent.gamma_multiply(0.16), Stroke::new(2.0, t.accent), egui::StrokeKind::Inside);
let font = egui::FontId::proportional(Tokens::get().font_heading);
let text = painter.layout(tr("ui.agent_chat_drop_hint").to_string(), font, t.text, (zone.width() - 24.0).max(40.0));
let at = zone.center() - text.size() / 2.0;
@@ -472,7 +472,7 @@ fn glyph_button(ui: &mut egui::Ui, kind: &str, tip: &str) -> egui::Response {
let t = Tokens::get();
let (r, resp) = ui.allocate_exact_size(vec2(t.form_close_size, t.form_close_size), Sense::click());
if resp.hovered() {
- ui.painter().rect_filled(r, 4.0, t.hover);
+ ui.painter().rect_filled(r, t.radius_sm, t.hover);
}
let c = r.center();
let s = Stroke::new(1.4, t.text);
@@ -534,7 +534,7 @@ fn strip(app: &mut SolveApp, ui: &mut egui::Ui) {
let resp = ui.interact(button, Id::new("sc_agent_chat_unfold"), Sense::click());
crate::scenario::publish_handle("agent_chat:unfold", button.center());
if resp.hovered() {
- ui.painter().rect_filled(button, 4.0, t.hover);
+ ui.painter().rect_filled(button, t.radius_sm, t.hover);
}
ui_kit::disclosure(ui.painter(), button.center(), false, t.text);
let state = app.agent_chat.state();
@@ -553,7 +553,7 @@ fn strip(app: &mut SolveApp, ui: &mut egui::Ui) {
}
ui.painter().line_segment(
if app.preferences.agent_chat_side == "left" { [r.right_top(), r.right_bottom()] } else { [r.left_top(), r.left_bottom()] },
- Stroke::new(1.0, t.border),
+ t.primary_border(t.border),
);
let tip = format!("{} · {}", tip(), state.label());
if resp.on_hover_text(tip).clicked() {
@@ -1298,7 +1298,7 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
Container::new(ui.ctx(), Surface::Panel)
.edge_frame(t.panel)
.stroke(Stroke::new(1.0, t.accent))
- .corner_radius(6.0)
+ .corner_radius(t.control_radius)
.inner_margin(egui::Margin::same(6))
.show(ui, |ui| {
ui.set_width(ui.available_width());
@@ -1481,9 +1481,12 @@ pub(super) fn remove_tip(f: &attach::Attachment) -> &'static str {
fn loading_chip(ui: &mut egui::Ui, name: &str, importing: bool, i: usize, w: f32) -> bool {
let t = Tokens::get();
let mut clicked = false;
- let r = egui::Frame::NONE.fill(t.toolbar).stroke(Stroke::new(1.0, t.border)).corner_radius(6.0).inner_margin(egui::Margin::symmetric(4, 3)).show(
- ui,
- |ui| {
+ let r = egui::Frame::NONE
+ .fill(t.toolbar)
+ .stroke(t.control_border_stroke(t.border))
+ .corner_radius(t.control_radius)
+ .inner_margin(egui::Margin::symmetric(4, 3))
+ .show(ui, |ui| {
let inner = (w - 10.0).max(40.0);
ui.set_width(inner);
ui.horizontal(|ui| {
@@ -1505,8 +1508,7 @@ fn loading_chip(ui: &mut egui::Ui, name: &str, importing: bool, i: usize, w: f32
crate::scenario::publish_handle(&format!("agent_chat:file_loading_remove:{i}"), c);
clicked = x.on_hover_text(tr(if importing { "ui.agent_chat_remove_imported" } else { "ui.agent_chat_remove_file" })).clicked();
});
- },
- );
+ });
crate::scenario::publish_handle(&format!("agent_chat:file_loading:{i}"), r.response.rect.center());
clicked
}
@@ -1516,9 +1518,12 @@ fn loading_chip(ui: &mut egui::Ui, name: &str, importing: bool, i: usize, w: f32
fn chip(ui: &mut egui::Ui, thumbs: &mut std::collections::HashMap<u64, egui::TextureHandle>, f: &attach::Attachment, i: usize, w: f32) -> bool {
let t = Tokens::get();
let mut clicked = false;
- let r = egui::Frame::NONE.fill(t.toolbar).stroke(Stroke::new(1.0, t.border)).corner_radius(6.0).inner_margin(egui::Margin::symmetric(4, 3)).show(
- ui,
- |ui| {
+ let r = egui::Frame::NONE
+ .fill(t.toolbar)
+ .stroke(t.control_border_stroke(t.border))
+ .corner_radius(t.control_radius)
+ .inner_margin(egui::Margin::symmetric(4, 3))
+ .show(ui, |ui| {
let inner = (w - 10.0).max(40.0);
ui.set_width(inner);
ui.horizontal(|ui| {
@@ -1561,8 +1566,7 @@ fn chip(ui: &mut egui::Ui, thumbs: &mut std::collections::HashMap<u64, egui::Tex
crate::scenario::publish_handle(&format!("agent_chat:file_remove:{i}"), c);
clicked = x.on_hover_text(remove_tip(f)).clicked();
});
- },
- );
+ });
crate::scenario::publish_target(&format!("agent_chat:file:{i}"), r.response.rect);
clicked
}
diff --git a/crates/ui-egui/src/browser.rs b/crates/ui-egui/src/browser.rs
index 7fc6164e7c..722ca27928 100644
--- a/crates/ui-egui/src/browser.rs
+++ b/crates/ui-egui/src/browser.rs
@@ -362,9 +362,9 @@ pub(crate) fn draw_row(ui: &mut egui::Ui, id: egui::Id, row: &Row) -> RowResp {
let dragged_over = egui::DragAndDrop::has_any_payload(ui.ctx()) && ui.input(|i| i.pointer.hover_pos()).is_some_and(|p| r.contains(p));
let mut out = RowResp { rect: Some(r), hovered: resp.hovered() || dragged_over, ..Default::default() };
if row.selected {
- ui.painter().rect_filled(r, 3.0, crate::theme::TabAccent::current(ui.ctx()).soft);
+ ui.painter().rect_filled(r, t.radius_sm.saturating_sub(1), crate::theme::TabAccent::current(ui.ctx()).soft);
} else if resp.hovered() || row.mark == Mark::Here {
- ui.painter().rect_filled(r, 3.0, t.hover);
+ ui.painter().rect_filled(r, t.radius_sm.saturating_sub(1), t.hover);
}
// A lit item (selected, or under the pointer in the 3D view): a bar down the left of its row,
// and a fainter, thinner one on each row leading to it, so the bars trace its branch.
@@ -374,7 +374,7 @@ pub(crate) fn draw_row(ui: &mut egui::Ui, id: egui::Id, row: &Row) -> RowResp {
Mark::Here => Some((3.0, t.accent)),
};
if let Some((w, colour)) = bar {
- ui.painter().rect_filled(Rect::from_min_size(r.left_top() + vec2(0.0, 2.0), vec2(w, r.height() - 4.0)), 1.0, colour);
+ ui.painter().rect_filled(Rect::from_min_size(r.left_top() + vec2(0.0, 2.0), vec2(w, r.height() - 4.0)), t.radius_sm / 4, colour);
}
let mut x = r.left() + 2.0 + row.depth as f32 * INDENT;
let cy = r.center().y;
@@ -846,7 +846,7 @@ fn browser_contents(app: &mut SolveApp, ui: &mut egui::Ui, acts: &mut Actions, c
{
return;
}
- ui.painter().hline(ui.max_rect().x_range(), ui.cursor().top() + 1.0, egui::Stroke::new(1.0, t.toolbar.lerp_to_gamma(t.border, 0.5)));
+ t.secondary_hline(ui.painter(), ui.max_rect().x_range(), ui.cursor().top() + 1.0, t.toolbar.lerp_to_gamma(t.border, 0.5));
ui.add_space(t.space_3);
if collapsible && !stacked {
browser_rows_hugging(app, ui, acts);
@@ -2113,7 +2113,9 @@ fn drop_target(ui: &egui::Ui, resp: &egui::Response, accept: impl Fn(&Drag) -> b
let r = resp.rect;
match mark {
DropMark::Above => ui.painter().hline(r.x_range(), r.top(), Stroke::new(2.0, t.accent)),
- DropMark::Box => ui.painter().rect_stroke(r.shrink(0.5), 3.0, Stroke::new(1.5, t.accent), egui::StrokeKind::Inside),
+ DropMark::Box => {
+ ui.painter().rect_stroke(r.shrink(0.5), t.radius_sm.saturating_sub(1), Stroke::new(1.5, t.accent), egui::StrokeKind::Inside)
+ }
};
}
// Taking a payload takes it whatever its type: leave other drags (appearance swatches) be.
@@ -2277,7 +2279,7 @@ pub fn dims_overlay(app: &SolveApp, ctx: &egui::Context) {
}
let Some(tc) = to(lay.text) else { continue };
let r = Rect::from_center_size(tc, size);
- painter.rect_filled(r, 2.0, tk.viewport_top.gamma_multiply(0.85));
+ painter.rect_filled(r, tk.radius_sm / 2, tk.viewport_top.gamma_multiply(0.85));
painter.galley(r.min + vec2(3.0, 1.0), galley, col);
}
}
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index 72ca873637..212ddff587 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -917,7 +917,7 @@ fn measure_line(app: &SolveApp, painter: &egui::Painter, proj: &Proj, r: &serde_
if app.preferences.measure_axis_distances {
measure_components(app, painter, proj, a, b, rect);
}
- painter.rect(rect, 3.0, t.overlay, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
+ painter.rect(rect, t.radius_sm.saturating_sub(1), t.overlay, t.control_border_stroke(t.border), egui::StrokeKind::Inside);
painter.galley(rect.min + vec2(5.0, 3.0), galley, t.text);
}
@@ -977,7 +977,7 @@ fn measure_components(app: &SolveApp, painter: &egui::Painter, proj: &Proj, a: V
}
}
painter.line_segment([at, rect.center()], Stroke::new(0.8, color));
- painter.rect(rect, 3.0, t.overlay, Stroke::new(1.0, color), egui::StrokeKind::Inside);
+ painter.rect(rect, t.radius_sm.saturating_sub(1), t.overlay, Stroke::new(1.0, color), egui::StrokeKind::Inside);
painter.galley(rect.min + vec2(5.0, 3.0), galley, t.text);
let handle = format!("measure:label:{axis}");
crate::scenario::publish_target(&handle, rect);
diff --git a/crates/ui-egui/src/colour_vision_tests.rs b/crates/ui-egui/src/colour_vision_tests.rs
index 2132323f0c..783452373a 100644
--- a/crates/ui-egui/src/colour_vision_tests.rs
+++ b/crates/ui-egui/src/colour_vision_tests.rs
@@ -379,6 +379,15 @@ const SHADED: [&str; 2] = ["analysis.draft", "analysis.access"];
/// Tokens no colour vision mode needs to keep apart, and why. A new token fails
/// `every_token_is_measured_or_carries_no_meaning` until it is in a group above or here.
const NO_MEANING: &[(&str, &str)] = &[
+ ("borders.primary", "structural chrome: hierarchy uses width, pattern and placement, not hue"),
+ ("borders.secondary", "structural chrome: hierarchy uses width, pattern and placement, not hue"),
+ ("borders.secondary_dotted", "structural chrome: hierarchy uses width, pattern and placement, not hue"),
+ ("borders.tertiary", "structural chrome: hierarchy uses width, pattern and placement, not hue"),
+ ("borders.container", "structural chrome: hierarchy uses width, pattern and placement, not hue"),
+ ("borders.control", "structural chrome: hierarchy uses width, pattern and placement, not hue"),
+ ("borders.primary_inset", "structural chrome: hierarchy uses width, pattern and placement, not hue"),
+ ("borders.bevel", "structural chrome: hierarchy uses width, pattern and placement, not hue"),
+ ("icon_palette", "optional SVG palette; actual roles and theme contrast are guarded in icon and theme tests"),
("file_dim", "File view secondary text, WCAG guarded in theme tests"),
("file_recovery_well", "decorative recovery icon ground"),
("file_action_height", "layout dimension"),
diff --git a/crates/ui-egui/src/dialogs_assembly.rs b/crates/ui-egui/src/dialogs_assembly.rs
index 11df42f5fd..caf6bfaf2a 100644
--- a/crates/ui-egui/src/dialogs_assembly.rs
+++ b/crates/ui-egui/src/dialogs_assembly.rs
@@ -1225,7 +1225,7 @@ pub fn timeline_joints(app: &mut SolveApp, ui: &mut egui::Ui, p: &egui::Painter,
} else {
t.timeline_item
};
- p.rect(br, 3.0, bg, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
+ p.rect(br, t.radius_sm.saturating_sub(1), bg, t.control_border_stroke(t.border), egui::StrokeKind::Inside);
crate::icons::paint_icon(p, br.shrink(4.0), "joint", f32::from((if suppressed { t.border } else { t.icon }).a()) / 255.0);
if suppressed {
p.line_segment([br.left_bottom() + vec2(4.0, -4.0), br.right_top() + vec2(-4.0, 4.0)], Stroke::new(1.5, t.text_dim));
@@ -1272,9 +1272,9 @@ pub fn timeline_joints_vertical(app: &mut SolveApp, ui: &mut egui::Ui) {
let (rect, response) = ui.allocate_exact_size(vec2(ui.available_width(), 30.0), egui::Sense::click());
crate::scenario::publish_handle(&format!("timeline-joint:{name}"), rect.center());
if app.tree.picked_joints.contains(&id) {
- ui.painter().rect_filled(rect, 3.0, t.accent_soft);
+ ui.painter().rect_filled(rect, t.radius_sm.saturating_sub(1), t.accent_soft);
} else if response.hovered() {
- ui.painter().rect_filled(rect, 3.0, t.hover);
+ ui.painter().rect_filled(rect, t.radius_sm.saturating_sub(1), t.hover);
}
let icon = egui::Rect::from_min_size(egui::pos2(rect.left() + 4.0, rect.top() + 4.0), vec2(22.0, 22.0));
crate::icons::paint_icon(ui.painter(), icon, "joint", f32::from((if suppressed { t.border } else { t.icon }).a()) / 255.0);
diff --git a/crates/ui-egui/src/dialogs_motion.rs b/crates/ui-egui/src/dialogs_motion.rs
index c4b1684b4c..ef724c3f26 100644
--- a/crates/ui-egui/src/dialogs_motion.rs
+++ b/crates/ui-egui/src/dialogs_motion.rs
@@ -175,7 +175,7 @@ fn transport(ui: &mut egui::Ui, what: Transport, tip: &str) -> egui::Response {
let t = Tokens::get();
let (r, resp) = ui.allocate_exact_size(vec2(26.0, 22.0), Sense::click());
let fill = if resp.hovered() { t.hover } else { t.field };
- ui.painter().rect(r, 3.0, fill, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
+ ui.painter().rect(r, t.radius_sm.saturating_sub(1), fill, t.control_border_stroke(t.border), egui::StrokeKind::Inside);
let c = r.center();
let ink = if matches!(what, Transport::Play | Transport::Stop) { t.accent } else { t.icon };
let p = ui.painter();
@@ -740,7 +740,7 @@ fn name_of(v: &Value) -> String {
fn key_strip(ui: &mut egui::Ui, tr: &Track, total: u32, now: u32, t: &Tokens) {
let (r, _) = ui.allocate_exact_size(vec2(240.0, 16.0), Sense::hover());
let p = ui.painter();
- p.rect_filled(r, 3.0, t.field);
+ p.rect_filled(r, t.radius_sm.saturating_sub(1), t.field);
let x = |s: u32| r.left() + 6.0 + (r.width() - 12.0) * s as f32 / total.max(1) as f32;
// Keys joined by a line (the motion between them).
let pts: Vec<Pos2> = tr.points.iter().map(|(s, _)| pos2(x(*s), r.center().y)).collect();
diff --git a/crates/ui-egui/src/dialogs_motion_plot.rs b/crates/ui-egui/src/dialogs_motion_plot.rs
index 03d9b01be7..df978ca673 100644
--- a/crates/ui-egui/src/dialogs_motion_plot.rs
+++ b/crates/ui-egui/src/dialogs_motion_plot.rs
@@ -142,7 +142,7 @@ fn chart(ui: &mut egui::Ui, xs: &[f64], ys: &[f64], unit: &str, total: u32, now:
let (r, resp) = ui.allocate_exact_size(vec2(300.0, 120.0), Sense::click_and_drag());
crate::scenario::publish_rect("motion:chart", r);
let p = ui.painter_at(r);
- p.rect(r, 3.0, t.field, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
+ p.rect(r, t.radius_sm.saturating_sub(1), t.field, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
let plot = Rect::from_min_max(r.min + vec2(6.0, 16.0), r.max - vec2(6.0, 16.0));
let total = f64::from(total.max(1));
let x = |s: f64| plot.left() + plot.width() * (s / total).clamp(0.0, 1.0) as f32;
diff --git a/crates/ui-egui/src/dialogs_save_mesh.rs b/crates/ui-egui/src/dialogs_save_mesh.rs
index 3e158ce0a2..1352edcadd 100644
--- a/crates/ui-egui/src/dialogs_save_mesh.rs
+++ b/crates/ui-egui/src/dialogs_save_mesh.rs
@@ -144,7 +144,7 @@ fn paint_icon(ui: &egui::Ui, rect: egui::Rect, tex: Option<egui::TextureId>, nam
}
None => {
let t = Tokens::get();
- ui.painter().rect_filled(rect, 3.0, t.chip);
+ ui.painter().rect_filled(rect, t.radius_sm.saturating_sub(1), t.chip);
let letter = name.chars().next().map(|c| c.to_uppercase().to_string()).unwrap_or_default();
ui.painter().text(
rect.center(),
@@ -212,7 +212,7 @@ fn slicer_combo(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut SaveMesh) {
let selected = e.key == k.slicer;
if resp.hovered() || selected {
let fill = if resp.hovered() { Tokens::get().hover } else { Tokens::get().selected_bg };
- ui.painter().rect_filled(rect, 2.0, fill);
+ ui.painter().rect_filled(rect, Tokens::get().radius_sm / 2, fill);
}
paint_icon(ui, egui::Rect::from_min_size(rect.left_center() + vec2(3.0, -ICON / 2.0), vec2(ICON, ICON)), tex, &e.slicer.name);
ui.painter().text(
@@ -240,7 +240,7 @@ fn slicer_combo(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut SaveMesh) {
}
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 22.0), Sense::click());
if resp.hovered() {
- ui.painter().rect_filled(rect, 2.0, Tokens::get().hover);
+ ui.painter().rect_filled(rect, Tokens::get().radius_sm / 2, Tokens::get().hover);
}
ui.painter().text(
rect.left_center() + vec2(ICON + 9.0, 0.0),
diff --git a/crates/ui-egui/src/dim_view.rs b/crates/ui-egui/src/dim_view.rs
index 7b4dd61b5c..1755edeacf 100644
--- a/crates/ui-egui/src/dim_view.rs
+++ b/crates/ui-egui/src/dim_view.rs
@@ -572,7 +572,7 @@ pub fn show(app: &mut SolveApp, ui: &egui::Ui, painter: &egui::Painter, proj: &P
}
let Some(tc) = to(lay.text) else { continue };
let r = Rect::from_center_size(tc, size);
- painter.rect_filled(r, 2.0, tk.viewport_top.gamma_multiply(0.85));
+ painter.rect_filled(r, tk.radius_sm / 2, tk.viewport_top.gamma_multiply(0.85));
painter.galley(r.min + vec2(3.0, 1.0), galley, col);
if matches!(frame, DimFrame::ArcLength { .. }) {
// The arc-length mark over the value.
diff --git a/crates/ui-egui/src/documents.rs b/crates/ui-egui/src/documents.rs
index c33af50374..1a41f59707 100644
--- a/crates/ui-egui/src/documents.rs
+++ b/crates/ui-egui/src/documents.rs
@@ -577,7 +577,7 @@ pub fn tabs(app: &mut SolveApp, ui: &mut egui::Ui, r: Rect, x0: f32, x1: f32) {
let xresp = ui.interact(xr, ui.id().with(("doc_close", i)), if show_close { Sense::click() } else { Sense::hover() });
crate::scenario::publish_target(&format!("tab:close:{i}"), xr);
if show_close && (xresp.hovered() || xresp.has_focus()) {
- ui.painter().rect_filled(xr, 3.0, t.app_bar_hover_strong);
+ ui.painter().rect_filled(xr, t.radius_sm.saturating_sub(1), t.app_bar_hover_strong);
}
if show_close {
crate::icons::paint_app_bar(
@@ -609,7 +609,7 @@ pub fn tabs(app: &mut SolveApp, ui: &mut egui::Ui, r: Rect, x0: f32, x1: f32) {
let mresp = ui.interact(mr, ui.id().with("doc_more"), Sense::click());
crate::scenario::publish_handle("tab:overflow", mr.center());
if mresp.hovered() {
- ui.painter().rect_filled(mr, 4.0, t.app_bar_hover_button);
+ ui.painter().rect_filled(mr, t.radius_sm, t.app_bar_hover_button);
}
ui.painter().text(
mr.center(),
@@ -687,7 +687,7 @@ pub fn tabs(app: &mut SolveApp, ui: &mut egui::Ui, r: Rect, x0: f32, x1: f32) {
let pr = Rect::from_center_size(pos2(x + 14.0, r.center().y), vec2(22.0, 22.0));
let presp = ui.interact(pr, ui.id().with("doc_new"), Sense::click());
if presp.hovered() {
- ui.painter().rect_filled(pr, 4.0, t.app_bar_hover_button);
+ ui.painter().rect_filled(pr, t.radius_sm, t.app_bar_hover_button);
}
crate::icons::paint_app_bar(
ui.painter(),
diff --git a/crates/ui-egui/src/drag_snap.rs b/crates/ui-egui/src/drag_snap.rs
index 1c2aa10e9c..d30c9c9d7e 100644
--- a/crates/ui-egui/src/drag_snap.rs
+++ b/crates/ui-egui/src/drag_snap.rs
@@ -231,7 +231,7 @@ pub fn show(app: &SolveApp, painter: &egui::Painter, proj: &Proj) {
let label = s.label();
if !label.is_empty() {
let r = egui::Rect::from_min_size(sp + egui::vec2(12.0, -24.0), egui::vec2(24.0, 14.0));
- painter.rect_filled(r, 3.0, tk.accent_soft);
+ painter.rect_filled(r, tk.radius_sm.saturating_sub(1), tk.accent_soft);
painter.text(r.center(), Align2::CENTER_CENTER, label, FontId::proportional(crate::theme::Tokens::get().font_micro), tk.text);
}
crate::scenario::publish_count("drag_guides", s.guides.len() as f64);
diff --git a/crates/ui-egui/src/frame_rate.rs b/crates/ui-egui/src/frame_rate.rs
index 30a1aa3bbc..6904539f0e 100644
--- a/crates/ui-egui/src/frame_rate.rs
+++ b/crates/ui-egui/src/frame_rate.rs
@@ -1,6 +1,6 @@
//! The viewport's frame-rate readout (Preferences ▸ Graphics ▸ "Frame rate").
-use egui::{FontId, Rect, Stroke, pos2, vec2};
+use egui::{FontId, Rect, pos2, vec2};
use crate::SolveApp;
use crate::theme::Tokens;
@@ -69,7 +69,7 @@ pub(crate) fn paint(app: &mut SolveApp, ctx: &egui::Context, painter: &egui::Pai
let galley = painter.layout_no_wrap(text, font, t.text);
let size = galley.size() + vec2(16.0, 8.0);
let r = Rect::from_min_size(pos2(rect.right() - 12.0 - size.x, rect.bottom() - 12.0 - size.y), size);
- painter.rect(r, 4.0, t.overlay, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
+ painter.rect(r, t.radius_sm, t.overlay, t.control_border_stroke(t.border), egui::StrokeKind::Inside);
crate::scenario::publish_target("viewport:frame_rate", r);
painter.galley(r.center() - galley.size() / 2.0, galley, t.text);
}
diff --git a/crates/ui-egui/src/icon_svg.rs b/crates/ui-egui/src/icon_svg.rs
index e7063768ab..05552ea0dc 100644
--- a/crates/ui-egui/src/icon_svg.rs
+++ b/crates/ui-egui/src/icon_svg.rs
@@ -8,7 +8,7 @@
//! (icon, accent, theme, pixel size). A master never carries a colour of its own: it names a
//! palette role, which resolves to the theme's hex, or to the accent's hex for the `active-*`
//! roles. GAP instead erases preceding artwork to transparency; it never paints a background.
-//! Changing a colour is an edit to `palette.toml` only.
+//! `palette.toml` owns defaults; theme files may override display roles and semantic ramps.
//!
//! Nothing here panics on bad artwork: a master that does not parse is logged and drawn as the
//! placeholder, and `every_master_parses` holds that none do.
@@ -431,6 +431,37 @@ impl Doc {
// ---------------------------------------------------------------------------------------------
// Rendering
+/// Theme-file overrides for stable SVG roles and semantic active-face ramps.
+/// Fixed-size storage keeps Tokens/Look copyable and bounds imported palette size.
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
+pub struct Palette {
+ pub(crate) roles: [Option<[u8; 3]>; ROLE_NAMES.len()],
+ pub(crate) accents: [Option<[[u8; 3]; 3]>; ACCENT_NAMES.len() + 1],
+}
+
+impl Palette {
+ fn rgb(self, role: usize, accent: Option<usize>) -> Option<[u8; 3]> {
+ let name = ROLE_NAMES.get(role)?;
+ let face = match *name {
+ "active-1" => Some(0),
+ "active-2" => Some(1),
+ "active-3" => Some(2),
+ _ => None,
+ };
+ if let Some(face) = face {
+ let ramp = self.accents.get(accent.map_or(0, |a| a.saturating_add(1))).copied().flatten();
+ if let Some(rgb) = ramp.and_then(|r| r.get(face).copied()) {
+ return Some(rgb);
+ }
+ // A base ramp never overwrites a semantic accent that the theme omitted.
+ if accent.is_some() {
+ return None;
+ }
+ }
+ self.roles.get(role).copied().flatten()
+ }
+}
+
/// The colours of one drawing: the theme and an accent (index into `ACCENT_NAMES`, or `None` for
/// the base palette).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
@@ -438,14 +469,16 @@ pub struct Look {
pub dark: bool,
pub accent: Option<usize>,
pub vision: crate::theme::ColorVision,
+ pub palette: Option<Palette>,
}
impl Look {
+ pub fn themed(dark: bool, accent: Option<usize>, vision: crate::theme::ColorVision) -> Self {
+ Self { dark, accent, vision, palette: crate::theme::Tokens::themed(dark, vision).icon_palette }
+ }
+
fn rgb(self, role: usize) -> [u8; 3] {
let theme = usize::from(self.dark);
- if ROLE_NAMES.get(role) == Some(&"guide") {
- return PALETTE.get(theme).and_then(|p| p.get(role)).copied().unwrap_or([255, 0, 255]);
- }
let vision = match self.vision {
crate::theme::ColorVision::Off => "",
crate::theme::ColorVision::Protan | crate::theme::ColorVision::Deutan => "red-green",
@@ -454,6 +487,12 @@ impl Look {
if let Some((_, _, _, l, d)) = ACCENT_VARIANTS.iter().find(|(v, a, r, _, _)| *v == vision && Some(*a) == self.accent && *r == role) {
return if self.dark { *d } else { *l };
}
+ if let Some(rgb) = self.palette.and_then(|p| p.rgb(role, self.accent)) {
+ return rgb;
+ }
+ if ROLE_NAMES.get(role) == Some(&"guide") {
+ return PALETTE.get(theme).and_then(|p| p.get(role)).copied().unwrap_or([255, 0, 255]);
+ }
if let Some((_, l, d)) = self.accent.and_then(|a| ACCENTS.get(a)).and_then(|items| items.iter().find(|(r, _, _)| *r == role)) {
return if self.dark { *d } else { *l };
}
@@ -629,7 +668,7 @@ fn default_accent(name: &str) -> Option<usize> {
/// Primary semantic stroke, also used by toolbar affordances. The palette owns its value.
pub(crate) fn primary(name: &str, dark: bool, vision: crate::theme::ColorVision) -> egui::Color32 {
- let look = Look { dark, accent: resolve(name).accent, vision };
+ let look = Look::themed(dark, resolve(name).accent, vision);
role_colour("active-3", look)
}
@@ -719,7 +758,7 @@ mod tests {
assert_eq!(blue.stroke, Paint::Role(active));
for dark in [false, true] {
for accent in std::iter::once(None).chain((0..ACCENT_NAMES.len()).map(Some)) {
- let look = Look { dark, accent, vision: crate::theme::ColorVision::Off };
+ let look = Look { dark, accent, vision: crate::theme::ColorVision::Off, palette: None };
assert_eq!(look.rgb(guide), PALETTE[usize::from(dark)][guide]);
let pm = render(&doc, look, 64).unwrap();
assert_eq!([pm.pixel(9, 20).unwrap().red(), pm.pixel(9, 20).unwrap().green(), pm.pixel(9, 20).unwrap().blue()], look.rgb(guide));
@@ -733,7 +772,7 @@ mod tests {
let doc = Doc::parse("<svg><path d='M0 0L64 0L64 64L0 64Z' fill='#8e9faf'/><circle cx='20' cy='20' r='10' fill='#ffffff'/><circle cx='20' cy='20' r='3' fill='#236ead'/><path d='M8 44L56 44' stroke='#ffffff' stroke-width='6'/><circle cx='44' cy='20' r='6' fill='#ffffff' opacity='0.5'/></svg>").unwrap();
for dark in [false, true] {
for accent in std::iter::once(None).chain((0..ACCENT_NAMES.len()).map(Some)) {
- let look = Look { dark, accent, vision: crate::theme::ColorVision::Off };
+ let look = Look { dark, accent, vision: crate::theme::ColorVision::Off, palette: None };
let pm = render(&doc, look, 64).unwrap();
assert_eq!(pm.pixel(26, 20).unwrap().alpha(), 0, "fill must reveal the real background");
assert_eq!(pm.pixel(20, 44).unwrap().alpha(), 0, "stroke must reveal the real background");
@@ -747,7 +786,7 @@ mod tests {
#[test]
fn knockout_respects_its_clip_and_combines_explicit_masks_with_clips() {
let doc = Doc::parse("<svg><defs><clipPath id='left'><path d='M0 0L32 0L32 64L0 64Z'/></clipPath><mask id='all'><path d='M0 0L64 0L64 64L0 64Z' fill='white'/></mask></defs><path d='M0 0L64 0L64 64L0 64Z' fill='#8e9faf'/><g clip-path='url(#left)'><circle cx='32' cy='32' r='16' fill='#ffffff' mask='url(#all)'/></g></svg>").unwrap();
- let pm = render(&doc, Look { dark: false, accent: None, vision: crate::theme::ColorVision::Off }, 64).unwrap();
+ let pm = render(&doc, Look { dark: false, accent: None, vision: crate::theme::ColorVision::Off, palette: None }, 64).unwrap();
assert_eq!(pm.pixel(24, 32).unwrap().alpha(), 0);
assert_eq!(pm.pixel(40, 32).unwrap().alpha(), 255, "cutout must not escape its parent clip");
}
@@ -755,7 +794,7 @@ mod tests {
#[test]
fn accepted_badges_and_environment_sun_have_transparent_holes() {
for dark in [false, true] {
- let look = Look { dark, accent: None, vision: crate::theme::ColorVision::Off };
+ let look = Look { dark, accent: None, vision: crate::theme::ColorVision::Off, palette: None };
assert_eq!(role_colour("gap", look), egui::Color32::TRANSPARENT);
for (id, x, y) in [("contact_new", 48, 48), ("environment_map", 45, 19), ("line_mid", 35, 28)] {
let pm = render(doc_for(id, 64).unwrap(), look, 64).unwrap();
@@ -768,7 +807,7 @@ mod tests {
fn native_clip_paths_and_plus_mask_keep_the_artwork_inside_its_shape() {
for dark in [false, true] {
for px in [16, 24, 64] {
- let look = Look { dark, accent: None, vision: crate::theme::ColorVision::Off };
+ let look = Look { dark, accent: None, vision: crate::theme::ColorVision::Off, palette: None };
for id in ["environment_map", "curvature_map", "iso_analysis", "zebra"] {
let doc = doc_for(id, px).unwrap();
let pm = render(doc, look, px).unwrap();
@@ -776,7 +815,8 @@ mod tests {
assert!(pm.pixel(px / 2, px / 2).unwrap().alpha() > 0, "{id} lost its clipped contents");
}
}
- let pm = render(doc_for("new", 64).unwrap(), Look { dark, accent: None, vision: crate::theme::ColorVision::Off }, 64).unwrap();
+ let pm =
+ render(doc_for("new", 64).unwrap(), Look { dark, accent: None, vision: crate::theme::ColorVision::Off, palette: None }, 64).unwrap();
assert_eq!(pm.pixel(45, 45).unwrap().alpha(), 0, "the plus is genuinely punched out in the native renderer");
}
}
@@ -808,6 +848,40 @@ mod tests {
}
}
+ #[test]
+ fn shipped_icon_palettes_preserve_alpha_shading_and_colour_vision_overrides() {
+ for file in crate::theme_files::builtin() {
+ let tokens = crate::theme_files::resolve(file);
+ let palette = tokens.icon_palette.expect("shipped icon palette");
+ for ramp in palette.accents.into_iter().flatten() {
+ // Ordered faces stay visibly distinct without changing accepted paths.
+ assert_ne!(ramp[0], ramp[1], "{} pale/medium", file.id);
+ assert_ne!(ramp[1], ramp[2], "{} medium/strong", file.id);
+ }
+ for vision in crate::theme::ColorVision::ALL {
+ for name in ["extrude", "surface_extrude", "mesh_export", "line", "c_parallel", "construction"] {
+ let resolved = resolve(name);
+ let plain = Look { dark: file.base.is_dark(), accent: resolved.accent, vision, palette: None };
+ let custom = Look { palette: Some(palette), ..plain };
+ let doc = doc_for(resolved.master, 32).unwrap();
+ let before = render(doc, plain, 32).unwrap();
+ let after = render(doc, custom, 32).unwrap();
+ assert!(before.pixels().iter().zip(after.pixels()).all(|(a, b)| a.alpha() == b.alpha()), "{} {name} alpha", file.id);
+ for (variant, accent, role, light, dark) in ACCENT_VARIANTS {
+ let selected = match vision {
+ crate::theme::ColorVision::Off => "",
+ crate::theme::ColorVision::Protan | crate::theme::ColorVision::Deutan => "red-green",
+ crate::theme::ColorVision::Tritan => "blue-yellow",
+ };
+ if *variant == selected && Some(*accent) == custom.accent {
+ assert_eq!(custom.rgb(*role), if file.base.is_dark() { *dark } else { *light });
+ }
+ }
+ }
+ }
+ }
+ }
+
#[test]
fn semantic_ui_tokens_and_icon_strokes_share_the_palette_including_accessibility() {
for dark in [false, true] {
@@ -828,7 +902,7 @@ mod tests {
let resolved = resolve(id);
for dark in [false, true] {
for vision in ColorVision::ALL {
- let look = Look { dark, accent: resolved.accent, vision };
+ let look = Look { dark, accent: resolved.accent, vision, palette: None };
let base = Look { accent: None, ..look };
for role in ["ink", "line", "passive-1", "passive-2", "passive-3", "gap"] {
let role = ROLE_NAMES.iter().position(|name| *name == role).unwrap();
@@ -898,7 +972,7 @@ mod tests {
let source = SVGS.iter().find(|(id, fam, _)| *id == "folder" && *fam == "model").unwrap().2;
let expected = Doc::parse(source).unwrap();
for dark in [false, true] {
- let look = Look { dark, accent: None, vision: crate::theme::ColorVision::Off };
+ let look = Look { dark, accent: None, vision: crate::theme::ColorVision::Off, palette: None };
let actual = render(doc_for("folder", 64).unwrap(), look, 64).unwrap();
let reviewed = render(&expected, look, 64).unwrap();
assert_eq!(actual.data(), reviewed.data());
@@ -922,7 +996,7 @@ mod tests {
for dark in [false, true] {
for px in [16, 20, 26, 64] {
let Some(doc) = doc_for(id, px) else { panic!("{id}") };
- let pm = render(doc, Look { dark, accent: None, vision: crate::theme::ColorVision::Off }, px)
+ let pm = render(doc, Look { dark, accent: None, vision: crate::theme::ColorVision::Off, palette: None }, px)
.unwrap_or_else(|| panic!("{id} at {px}"));
assert!(coverage(&pm) > 8, "{id} at {px}px (dark {dark}) is blank");
}
@@ -937,13 +1011,15 @@ mod tests {
#[test]
fn dark_theme_and_accents_change_colour_not_shape() {
let doc = doc_for("extrude", 64).unwrap_or_else(|| panic!("extrude"));
- let light = render(doc, Look { dark: false, accent: None, vision: crate::theme::ColorVision::Off }, 64).unwrap_or_else(|| panic!("render"));
- let dark = render(doc, Look { dark: true, accent: None, vision: crate::theme::ColorVision::Off }, 64).unwrap_or_else(|| panic!("render"));
+ let light = render(doc, Look { dark: false, accent: None, vision: crate::theme::ColorVision::Off, palette: None }, 64)
+ .unwrap_or_else(|| panic!("render"));
+ let dark = render(doc, Look { dark: true, accent: None, vision: crate::theme::ColorVision::Off, palette: None }, 64)
+ .unwrap_or_else(|| panic!("render"));
assert_ne!(rgba(&light), rgba(&dark));
let r = resolve("surface_extrude");
assert_eq!(r.master, "extrude");
- let surface =
- render(doc, Look { dark: false, accent: r.accent, vision: crate::theme::ColorVision::Off }, 64).unwrap_or_else(|| panic!("render"));
+ let surface = render(doc, Look { dark: false, accent: r.accent, vision: crate::theme::ColorVision::Off, palette: None }, 64)
+ .unwrap_or_else(|| panic!("render"));
assert!(r.accent.is_some());
assert_ne!(rgba(&light), rgba(&surface));
// Same silhouette: the alpha channel is identical.
@@ -987,7 +1063,7 @@ mod tests {
fn danger_tint_preserves_faces_outlines_and_transparent_details() {
for dark in [false, true] {
for vision in crate::theme::ColorVision::ALL {
- let look = Look { dark, accent: accent_index("constraint"), vision };
+ let look = Look { dark, accent: accent_index("constraint"), vision, palette: None };
for id in ["delete", "new", "extrude"] {
for px in [16, 20, 64] {
let doc = doc_for(id, px).unwrap();
diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rs
index b801fed033..05715320ba 100644
--- a/crates/ui-egui/src/icons.rs
+++ b/crates/ui-egui/src/icons.rs
@@ -1,8 +1,9 @@
//! Stable UI rendering boundary for the icon artwork. Compiled only at L5.
//!
//! Command, menu, browser and timeline icons are the SVG masters in `assets/icons/ui/design/svg`,
-//! rendered by [`crate::icon_svg`]: colours come from `palette.toml` (light and dark, and the
-//! accents), never from the caller. An icon with no master yet draws the placeholder.
+//! rendered by [`crate::icon_svg`]: colours come from the default `palette.toml` roles/accents
+//! and optional active-theme overrides, never arbitrary caller tints. An icon with no master
+//! yet draws the placeholder.
//! The glyph, marker, navigation and pointer sources below are not command icons.
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
@@ -29,7 +30,13 @@ enum Finish {
/// Textures already rasterised: one per (master, look, pixel size, finish).
#[derive(Clone, Default)]
-struct Cache(Arc<Mutex<HashMap<(&'static str, Look, u32, Finish), TextureHandle>>>);
+struct Cache(Arc<Mutex<CacheEntries>>);
+
+#[derive(Default)]
+struct CacheEntries {
+ palette: Option<icon_svg::Palette>,
+ textures: HashMap<(&'static str, Look, u32, Finish), TextureHandle>,
+}
/// Draw palette-owned icon artwork with an explicit opacity (0 to 1).
pub fn paint_icon(p: &Painter, r: Rect, name: &str, opacity: f32) {
@@ -72,7 +79,7 @@ enum Mirror {
fn paint_with_ink(p: &Painter, r: Rect, name: &str, dark: Option<bool>, opacity: f32, ink: Option<Color32>, mirror: Mirror) {
let ctx = p.ctx();
let resolved = icon_svg::resolve(name);
- let look = Look { dark: dark.unwrap_or_else(|| ctx.global_style().visuals.dark_mode), accent: resolved.accent, vision: crate::theme::vision() };
+ let look = Look::themed(dark.unwrap_or_else(|| ctx.global_style().visuals.dark_mode), resolved.accent, crate::theme::vision());
paint_resolved(p, r, resolved, look, opacity, ink.map_or(Finish::Artwork, Finish::Ink), mirror);
}
@@ -85,7 +92,7 @@ pub fn paint_accented(p: &Painter, r: Rect, name: &str, accent: Option<&str>, op
Some(name) => icon_svg::accent_index(name).or(resolved.accent),
None => None,
};
- let look = Look { dark: p.ctx().global_style().visuals.dark_mode, accent, vision: crate::theme::vision() };
+ let look = Look::themed(p.ctx().global_style().visuals.dark_mode, accent, crate::theme::vision());
paint_resolved(p, r, resolved, look, opacity, Finish::Artwork, Mirror::None);
}
@@ -94,7 +101,7 @@ pub fn paint_accented(p: &Painter, r: Rect, name: &str, accent: Option<&str>, op
/// the constraint ramp without flattening the lid, handle or other details.
pub(crate) fn paint_danger(p: &Painter, r: Rect, name: &str, opacity: f32) {
let resolved = icon_svg::resolve(name);
- let look = Look { dark: p.ctx().global_style().visuals.dark_mode, accent: icon_svg::accent_index("constraint"), vision: crate::theme::vision() };
+ let look = Look::themed(p.ctx().global_style().visuals.dark_mode, icon_svg::accent_index("constraint"), crate::theme::vision());
paint_resolved(p, r, resolved, look, opacity, Finish::Danger, Mirror::None);
}
@@ -104,7 +111,13 @@ fn paint_resolved(p: &Painter, r: Rect, resolved: icon_svg::Resolved, look: Look
let side = r.width().min(r.height());
let px = (side * ppp).round().clamp(8.0, 512.0) as u32;
let cache = ctx.data_mut(|d| d.get_temp_mut_or_insert_with(egui::Id::new("sc_icon_cache"), Cache::default).clone());
- let Ok(mut map) = cache.0.lock() else { return };
+ let Ok(mut entries) = cache.0.lock() else { return };
+ let palette = crate::theme::Tokens::get().icon_palette;
+ if entries.palette != palette {
+ entries.textures.clear();
+ entries.palette = palette;
+ }
+ let map = &mut entries.textures;
let key = (resolved.master, look, px, finish);
if let std::collections::hash_map::Entry::Vacant(slot) = map.entry(key) {
let Some(doc) = icon_svg::doc_for(resolved.master, px) else { return };
@@ -136,6 +149,62 @@ mod tests {
use super::*;
use crate::theme::{self, ColorVision};
+ #[test]
+ fn theme_icon_palettes_change_uploaded_pixels_and_reuse_only_matching_textures() {
+ use serde_json::json;
+ let ctx = crate::fonts::test_context();
+ let dark = theme::is_dark();
+ ctx.set_visuals(if dark { egui::Visuals::dark() } else { egui::Visuals::light() });
+ let mut previous_alpha = None;
+ let mut previous_texture = None;
+ for (stroke, expected) in [
+ ("#994477", Color32::from_rgb(0x99, 0x44, 0x77)),
+ ("#226699", Color32::from_rgb(0x22, 0x66, 0x99)),
+ ("#994477", Color32::from_rgb(0x99, 0x44, 0x77)),
+ ] {
+ let file = crate::theme_files::from_value(&json!({"format":crate::theme_files::FORMAT,
+ "name":"Switch","base":if dark {"dark"} else {"light"},
+ "icon_palette":{"solid":["#c0d0e0","#668899",stroke]}}))
+ .unwrap();
+ let _restore = theme::scoped_tokens(crate::theme_files::resolve(&file));
+ let draw = |ui: &mut egui::Ui| {
+ let r = Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(64.0, 64.0));
+ paint_icon(ui.painter(), r, "extrude", 1.0);
+ // A forced-dark monochrome app-bar icon must not evict the theme palette.
+ paint_app_bar(ui.painter(), r.translate(egui::vec2(70.0, 0.0)), "save", 1.0);
+ };
+ let mut out = ctx.run_ui(egui::RawInput::default(), draw);
+ let (id, image) = out
+ .textures_delta
+ .set
+ .iter()
+ .flat_map(|(id, deltas)| deltas.iter().map(move |d| (id, &d.image)))
+ .find_map(|(id, data)| match data {
+ egui::ImageData::Color(image) if image.size == [64, 64] && image.pixels.contains(&expected) => Some((*id, image)),
+ _ => None,
+ })
+ .expect("the new theme's actual SVG texture");
+ let alpha: Vec<_> = image.pixels.iter().map(|p| p.a()).collect();
+ if let Some(old) = &previous_alpha {
+ assert_eq!(&alpha, old, "theme colours preserve artwork and cutouts");
+ }
+ if let Some(old) = previous_texture {
+ assert_ne!(id, old, "switching a same-base theme uploads a new texture");
+ }
+ previous_alpha = Some(alpha);
+ previous_texture = Some(id);
+ out.textures_delta.clear();
+ let mut steady = ctx.run_ui(egui::RawInput::default(), draw);
+ assert!(
+ steady.textures_delta.set.values().flatten().all(|d| match &d.image {
+ egui::ImageData::Color(i) => i.size != [64, 64],
+ }),
+ "unchanged palette reuses cached textures"
+ );
+ steady.textures_delta.clear();
+ }
+ }
+
#[test]
fn assistant_pixels_use_the_application_bar_text_token() {
let previous = theme::is_dark();
@@ -254,7 +323,7 @@ mod tests {
assert!(!output.textures_delta.set.contains_key(&texture));
}
let image = textures.get(&texture).unwrap();
- let look = Look { dark, accent: expected_accent, vision };
+ let look = Look::themed(dark, expected_accent, vision);
for role in ["ink", "passive-2", "passive-3", "active-1", "active-2", "active-3"] {
assert!(image.pixels.contains(&icon_svg::role_colour(role, look)), "{accent:?}/{role}, {dark}/{vision:?}");
}
diff --git a/crates/ui-egui/src/prefs.rs b/crates/ui-egui/src/prefs.rs
index 85ff372b07..7bafc77dd8 100644
--- a/crates/ui-egui/src/prefs.rs
+++ b/crates/ui-egui/src/prefs.rs
@@ -1499,6 +1499,11 @@ pub fn set(app: &mut SolveApp, p: &serde_json::Value) -> Result<serde_json::Valu
if new.custom_themes.len() > crate::theme_files::MAX_CUSTOM || new.custom_themes.iter().any(|t| t.colors.len() > crate::theme_files::MAX_COLORS) {
return Err(format!("at most {} imported themes of {} colours each", crate::theme_files::MAX_CUSTOM, crate::theme_files::MAX_COLORS));
}
+ for theme in &new.custom_themes {
+ theme.validate_radii()?;
+ crate::theme_files::parse_icon_palette(&theme.icon_palette)?;
+ crate::theme_files::parse_borders(&theme.borders)?;
+ }
if !crate::i18n::is_supported(&new.language) {
return Err(format!("`language` must be one of: {}", crate::i18n::LOCALES.iter().map(|locale| locale.id).collect::<Vec<_>>().join(", ")));
}
@@ -1753,16 +1758,26 @@ mod tests {
solidcraft_engine::render::Rgb(hard.viewport_top.r(), hard.viewport_top.g(), hard.viewport_top.b())
);
- let file = json!({"format": "solidcraft-theme/1", "name": "Paper", "base": "light", "colors": {"panel": "#fffdf0", "accent": "#aa3300"}});
+ let file = json!({"format": "solidcraft-theme/1", "name": "Paper", "base": "light", "colors": {"panel": "#fffdf0", "accent": "#aa3300"}, "borders":{"primary":{"width":2,"color":"#ffffff"},"tertiary":{"width":0,"color":"#000000"}}, "radii": {"radius_sm": 0, "control_radius": 0, "radius_xl": 16}});
let out = h.call("ui.prefs", json!({"theme_import": file, "theme_export": true}));
assert_eq!(out["result"]["theme_imported"], "paper", "{out}");
assert_eq!((out["result"]["theme"].as_str(), out["result"]["dark"].as_bool()), (Some("paper"), Some(false)));
let exported = &out["result"]["theme_file"];
assert_eq!((exported["name"].as_str(), exported["base"].as_str()), (Some("Paper"), Some("light")));
assert_eq!(exported["colors"]["panel"], "#fffdf0");
+ assert_eq!(exported["radii"]["control_radius"], 0);
+ assert_eq!(exported["radii"]["radius_xl"], 16);
+ assert_eq!(exported["radii"]["radius_md"], 6);
+ assert_eq!(exported["borders"]["primary"]["width"], 2.0);
assert_eq!(exported["colors"]["text"].as_str().map(str::len), Some(7), "an export is complete: {exported}");
h.frames(2);
assert_eq!((Tokens::get().panel, Tokens::get().text), (egui::Color32::from_rgb(0xff, 0xfd, 0xf0), Tokens::light().text));
+ assert_eq!((Tokens::get().control_radius, Tokens::get().radius_xl), (0, 16));
+ let invalid = h.call(
+ "ui.prefs",
+ json!({"theme_import": {"format": "solidcraft-theme/1", "name": "Bad", "base": "dark", "radii": {"control_radius": -1}}}),
+ );
+ assert!(invalid["error"].as_str().is_some_and(|e| e.contains("radii.control_radius")));
let out = h.call(
"ui.prefs",
json!({"theme_import": "{\"format\":\"solidcraft-theme/1\",\"name\":\"x\",\"base\":\"dark\",\"colors\":{\"nope\":\"#000000\"}}"}),
@@ -1774,6 +1789,8 @@ mod tests {
let mut other = crate::SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());
other.load_prefs(&h.app.prefs());
assert_eq!((other.preferences.theme.as_str(), other.preferences.custom_themes.len()), ("paper", 1));
+ assert_eq!(other.preferences.custom_themes[0].radii, h.app.preferences.custom_themes[0].radii);
+ assert_eq!(other.preferences.custom_themes[0].borders, h.app.preferences.custom_themes[0].borders);
let out = h.call("ui.prefs", json!({"theme_remove": "paper"}));
assert_eq!((out["result"]["theme"].as_str(), out["result"]["dark"].as_bool()), (Some("light"), Some(false)), "{out}");
@@ -1788,6 +1805,7 @@ mod tests {
assert!(h.app.preferences.custom_themes.is_empty(), "Cancel takes the import back");
h.frames(2);
assert_eq!(Tokens::get().panel, Tokens::dark().panel);
+ assert_eq!((Tokens::get().control_radius, Tokens::get().radius_xl), (6, 10));
}
/// Picking a font closes the font list, not the Preferences window's body: that folded the
diff --git a/crates/ui-egui/src/render_workspace.rs b/crates/ui-egui/src/render_workspace.rs
index b0695e2385..e9490dbbe7 100644
--- a/crates/ui-egui/src/render_workspace.rs
+++ b/crates/ui-egui/src/render_workspace.rs
@@ -174,7 +174,7 @@ pub fn panel(app: &mut SolveApp, ui: &mut egui::Ui) {
app.render_workspace.view.draft = app.session.doc.render.setups.get(&app.render_workspace.view.name).cloned().unwrap_or_default();
app.render_workspace.revision = app.session.revision;
}
- Container::new(ui.ctx(), Surface::Panel)
+ let response = Container::new(ui.ctx(), Surface::Panel)
.edge("sc_render_settings", Edge::Right)
.exact_size(285.0)
.resizable(false)
@@ -260,6 +260,8 @@ pub fn panel(app: &mut SolveApp, ui: &mut egui::Ui) {
});
});
});
+ let frame = Container::new(ui.ctx(), Surface::Panel).edge_frame(Tokens::get().panel).inner_margin(10);
+ Container::paint_inset(ui.painter(), response.response.rect - frame.outer_margin, frame);
}
fn image_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
diff --git a/crates/ui-egui/src/select_other.rs b/crates/ui-egui/src/select_other.rs
index 6dd7cd9802..00e310274c 100644
--- a/crates/ui-egui/src/select_other.rs
+++ b/crates/ui-egui/src/select_other.rs
@@ -539,7 +539,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
crate::scenario::publish_handle(&format!("select_other:{i}"), r.center());
if resp.hovered() {
hovered = Some(i);
- ui.painter().rect_filled(r.shrink2(vec2(2.0, 1.0)), 4.0, t.hover);
+ ui.painter().rect_filled(r.shrink2(vec2(2.0, 1.0)), t.radius_sm, t.hover);
}
crate::icons::paint_icon(
ui.painter(),
diff --git a/crates/ui-egui/src/shell.rs b/crates/ui-egui/src/shell.rs
index 1bf91d86cf..f1048c486a 100644
--- a/crates/ui-egui/src/shell.rs
+++ b/crates/ui-egui/src/shell.rs
@@ -31,7 +31,7 @@ pub(crate) const SHELL_GAP: f32 = 7.0;
/// The viewport's top corners are rounded concentrically with the cards: the card margin plus the
/// card radius.
pub(crate) fn corner_radius() -> f32 {
- SHELL_GAP + f32::from(Tokens::get().radius_lg)
+ Tokens::outset_radius(f32::from(Tokens::get().radius_lg), SHELL_GAP)
}
/// Fill the two concave corners where the application bar flows into the viewport's top edge, so
diff --git a/crates/ui-egui/src/sketch_tools.rs b/crates/ui-egui/src/sketch_tools.rs
index 42c8776fb6..cca2047858 100644
--- a/crates/ui-egui/src/sketch_tools.rs
+++ b/crates/ui-egui/src/sketch_tools.rs
@@ -205,7 +205,7 @@ fn continuity_legend(app: &SolveApp, painter: &egui::Painter, proj: &Proj) {
let size = egui::vec2(pad + swatch + 8.0 + text_width + pad, rows.len() as f32 * row + 2.0 * pad);
let available = crate::shell::bottom_overlay_rect(app, proj.rect);
let frame = egui::Rect::from_min_size(available.left_bottom() + egui::vec2(16.0, -(size.y + 16.0)), size);
- painter.rect_filled(frame, 4.0, tk.panel.gamma_multiply(0.9));
+ painter.rect_filled(frame, tk.radius_sm, tk.panel.gamma_multiply(0.9));
crate::scenario::publish_rect("continuity_legend", frame);
for (i, (label, col)) in rows.iter().enumerate() {
let y = frame.top() + pad + row * (i as f32 + 0.5);
@@ -252,7 +252,7 @@ fn marks(app: &SolveApp, painter: &egui::Painter, proj: &Proj) {
egui::FontId::proportional(crate::theme::Tokens::get().font_body),
tk.text,
);
- painter.rect_filled(r.expand(3.0), 3.0, tk.panel.gamma_multiply(0.85));
+ painter.rect_filled(r.expand(3.0), tk.radius_sm.saturating_sub(1), tk.panel.gamma_multiply(0.85));
painter.text(
q + egui::vec2(12.0, -12.0),
egui::Align2::LEFT_BOTTOM,
@@ -1317,8 +1317,13 @@ fn glyphs(app: &SolveApp, painter: &egui::Painter, proj: &Proj, hover: Option<Po
painter.line_segment([*base, *sp], Stroke::new(0.8, tk.text_dim.gamma_multiply(0.6)));
}
let r = egui::Rect::from_center_size(*sp, egui::vec2(GLYPH, GLYPH));
- painter.rect_filled(r, 3.0, if lit { tk.accent_soft } else { tk.glyph_bg });
- painter.rect_stroke(r, 3.0, Stroke::new(1.0, if failing || lit { col } else { tk.glyph_edge }), egui::StrokeKind::Inside);
+ painter.rect_filled(r, tk.radius_sm.saturating_sub(1), if lit { tk.accent_soft } else { tk.glyph_bg });
+ painter.rect_stroke(
+ r,
+ tk.radius_sm.saturating_sub(1),
+ Stroke::new(1.0, if failing || lit { col } else { tk.glyph_edge }),
+ egui::StrokeKind::Inside,
+ );
let pattern_icon = ss.sketch.patterns.iter().find(|p| p.instances.first().and_then(|i| i.constraints.first()) == Some(id)).map(|p| {
if matches!(p.kind, solidcraft_engine::sketch::SketchPatternKind::Circular { .. }) {
"sketch_circ_pattern"
@@ -1351,7 +1356,7 @@ fn glyphs(app: &SolveApp, painter: &egui::Painter, proj: &Proj, hover: Option<Po
};
let at = h + egui::vec2(12.0, 12.0);
let g = painter.layout_no_wrap(label, egui::FontId::proportional(crate::theme::Tokens::get().font_small), tk.text);
- painter.rect_filled(egui::Rect::from_min_size(at, g.size()).expand(3.0), 3.0, tk.panel);
+ painter.rect_filled(egui::Rect::from_min_size(at, g.size()).expand(3.0), tk.radius_sm.saturating_sub(1), tk.panel);
painter.galley(at, g, tk.text);
}
GLYPHS.with(|g| *g.borrow_mut() = drawn);
@@ -1431,7 +1436,7 @@ fn snap_hint(app: &SolveApp, painter: &egui::Painter, proj: &Proj) {
let Some(sp) = proj.to_screen(ss.plane.to_world(p)) else { return };
let tk = crate::theme::Tokens::get();
let r = egui::Rect::from_min_size(sp + egui::vec2(12.0, -24.0), egui::vec2(24.0, 14.0));
- painter.rect_filled(r, 3.0, tk.accent_soft);
+ painter.rect_filled(r, tk.radius_sm.saturating_sub(1), tk.accent_soft);
painter.text(r.center(), egui::Align2::CENTER_CENTER, label, egui::FontId::proportional(crate::theme::Tokens::get().font_micro), tk.text);
}
diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs
index c564342ad7..dd9989e7a1 100644
--- a/crates/ui-egui/src/theme.rs
+++ b/crates/ui-egui/src/theme.rs
@@ -27,6 +27,193 @@ thread_local! {
static CUSTOM: Cell<Option<Custom>> = const { Cell::new(None) };
}
+/// Three structural border levels plus independent content and control outlines.
+/// Focus, selection, status, artwork and CAD geometry do not use these roles.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum BorderRole {
+ Primary,
+ Secondary,
+ Tertiary,
+ Container,
+ Control,
+}
+
+#[derive(Clone, Copy, Debug, Default, PartialEq)]
+pub struct Borders {
+ pub primary: Option<Stroke>,
+ pub secondary: Option<Stroke>,
+ /// Pattern for secondary section rules; solid preserves existing themes.
+ pub secondary_dotted: bool,
+ pub tertiary: Option<Stroke>,
+ /// Solid outlines for nested previews, information wells and shortcut keycaps.
+ pub container: Option<Stroke>,
+ pub control: Option<Stroke>,
+ pub primary_inset: Option<InsetBorder>,
+ /// Optional directional chrome. Absent themes keep their flat strokes.
+ pub bevel: Option<Bevel>,
+}
+
+/// Two directional edge bands, shared by raised chrome and recessed editors.
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct Bevel {
+ pub width: f32,
+ pub highlight: Color32,
+ pub light: Color32,
+ pub shadow: Color32,
+ pub dark_shadow: Color32,
+}
+
+impl Bevel {
+ /// Draw inside existing geometry; no extra input targets or layout allocation.
+ pub fn paint(self, painter: &egui::Painter, rect: egui::Rect, radius: impl Into<egui::CornerRadius>, recessed: bool, enabled: bool) {
+ if !rect.is_finite() || self.width <= 0.0 || !self.width.is_finite() || rect.width().min(rect.height()) <= self.width * 4.0 {
+ return;
+ }
+ let radius = radius.into();
+ let bands = if recessed {
+ [(self.shadow, self.highlight), (self.dark_shadow, self.light)]
+ } else {
+ [(self.highlight, self.dark_shadow), (self.light, self.shadow)]
+ };
+ for (index, (upper, lower)) in bands.into_iter().enumerate() {
+ let inset = (index as f32 + 0.5) * self.width;
+ let edge = rect.shrink(inset);
+ let mut rounding: egui::epaint::CornerRadiusF32 = radius.into();
+ rounding -= inset;
+ let mut path = Vec::new();
+ egui::epaint::tessellator::path::rounded_rectangle(&mut path, edge, rounding);
+ if let Some(first) = path.first().copied() {
+ path.push(first);
+ }
+ for pair in path.windows(2) {
+ if let Some((a, b)) = pair.first().zip(pair.get(1)) {
+ let middle = *a + (*b - *a) * 0.5;
+ let relative = (middle - edge.center()) / edge.size();
+ let color = if relative.x + relative.y < 0.0 { upper } else { lower };
+ let color = if enabled { color } else { color.gamma_multiply(0.45) };
+ painter.line_segment([*a, *b], Stroke::new(self.width, color));
+ }
+ }
+ }
+ }
+}
+
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct InsetBorder {
+ pub stroke: Stroke,
+ /// Clear distance from the inner edge of the primary stroke, in logical points.
+ pub gap: f32,
+}
+
+impl Borders {
+ pub const LEGACY: Self = Self {
+ primary: None,
+ secondary: None,
+ secondary_dotted: false,
+ tertiary: None,
+ container: None,
+ control: None,
+ primary_inset: None,
+ bevel: None,
+ };
+
+ pub fn stroke(self, role: BorderRole, fallback: Stroke) -> Stroke {
+ match role {
+ BorderRole::Primary => self.primary,
+ BorderRole::Secondary => self.secondary,
+ BorderRole::Tertiary => self.tertiary,
+ BorderRole::Container => self.container,
+ BorderRole::Control => self.control,
+ }
+ .unwrap_or(fallback)
+ }
+}
+
+impl Tokens {
+ /// Bevel themes use the editable surface colour independently of button faces.
+ pub fn input_fill(&self) -> Color32 {
+ if self.borders.bevel.is_some() { self.field } else { self.control_fill }
+ }
+
+ pub fn input_bevel(&self, ui: &egui::Ui, response: &egui::Response) {
+ if let Some(bevel) = self.borders.bevel {
+ bevel.paint(ui.painter(), response.rect.shrink(1.0), self.control_radius, true, response.enabled());
+ }
+ }
+
+ pub fn button_bevel(&self, ui: &egui::Ui, response: &egui::Response, selected: bool) {
+ self.button_bevel_with_radius(ui, response, selected, self.control_radius);
+ }
+
+ /// Compound controls supply the same corner geometry as their selected fill.
+ pub fn button_bevel_with_radius(&self, ui: &egui::Ui, response: &egui::Response, selected: bool, radius: impl Into<egui::CornerRadius>) {
+ if let Some(bevel) = self.borders.bevel {
+ let pressed = response.enabled()
+ && (response.is_pointer_button_down_on()
+ || (response.has_focus() && ui.input(|i| i.key_down(egui::Key::Space) || i.key_down(egui::Key::Enter))));
+ bevel.paint(ui.painter(), response.rect, radius, selected || pressed, response.enabled());
+ }
+ }
+
+ pub fn primary_border(&self, color: Color32) -> Stroke {
+ self.borders.stroke(BorderRole::Primary, Stroke::new(1.0, color))
+ }
+ pub fn secondary_border(&self, color: Color32) -> Stroke {
+ self.borders.stroke(BorderRole::Secondary, Stroke::new(1.0, color))
+ }
+ /// Secondary rules share a pattern as well as a stroke. Dot count is bounded for tiny widths.
+ fn secondary_dots(&self, painter: &egui::Painter, path: &[egui::Pos2], stroke: Stroke) {
+ if stroke.width <= 0.0 || path.iter().any(|p| !p.is_finite()) {
+ return;
+ }
+ let length: f32 = path.windows(2).map(|pair| pair.first().zip(pair.get(1)).map_or(0.0, |(a, b)| a.distance(*b))).sum();
+ if !length.is_finite() {
+ return;
+ }
+ let spacing = (stroke.width * 3.0).max(3.0).max(length / 4096.0);
+ painter.extend(egui::Shape::dotted_line(path, stroke.color, spacing, stroke.width * 0.5));
+ }
+
+ pub fn secondary_line(&self, painter: &egui::Painter, points: [egui::Pos2; 2], color: Color32) {
+ let stroke = self.secondary_border(color);
+ if self.borders.secondary_dotted {
+ self.secondary_dots(painter, &points, stroke);
+ } else {
+ painter.line_segment(points, stroke);
+ }
+ }
+
+ pub fn secondary_hline(&self, painter: &egui::Painter, range: impl Into<egui::emath::Rangef>, y: f32, color: Color32) {
+ let range = range.into();
+ self.secondary_line(painter, [egui::pos2(range.min, y), egui::pos2(range.max, y)], color);
+ }
+
+ pub fn secondary_vline(&self, painter: &egui::Painter, x: f32, range: impl Into<egui::emath::Rangef>, color: Color32) {
+ let range = range.into();
+ self.secondary_line(painter, [egui::pos2(x, range.min), egui::pos2(x, range.max)], color);
+ }
+
+ /// Enclosures stay solid independently of the section-divider pattern.
+ pub fn container_rect(&self, painter: &egui::Painter, rect: egui::Rect, radius: impl Into<egui::CornerRadius>, fill: Color32, color: Color32) {
+ let radius = radius.into();
+ painter.rect(rect, radius, fill, self.container_border(color), egui::StrokeKind::Inside);
+ if let Some(bevel) = self.borders.bevel {
+ bevel.paint(painter, rect, radius, false, true);
+ }
+ }
+
+ pub fn container_border(&self, color: Color32) -> Stroke {
+ self.borders.stroke(BorderRole::Container, Stroke::new(1.0, color))
+ }
+
+ pub fn tertiary_border(&self, color: Color32) -> Stroke {
+ self.borders.stroke(BorderRole::Tertiary, Stroke::new(1.0, color))
+ }
+ pub fn control_border_stroke(&self, color: Color32) -> Stroke {
+ self.borders.stroke(BorderRole::Control, Stroke::new(1.0, color))
+ }
+}
+
/// A theme file's palette and whether it is dark.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Custom {
@@ -40,6 +227,20 @@ pub fn set_custom(custom: Option<Custom>) -> bool {
CUSTOM.with(|c| c.replace(custom) != custom)
}
+/// Isolated widget tests restore the thread's theme even when an assertion fails.
+#[cfg(test)]
+pub(crate) fn scoped_tokens(tokens: Tokens) -> impl Drop {
+ struct Restore(Option<Custom>);
+ impl Drop for Restore {
+ fn drop(&mut self) {
+ set_custom(self.0);
+ }
+ }
+ let restore = Restore(CUSTOM.get());
+ set_custom(Some(Custom { dark: is_dark(), tokens }));
+ restore
+}
+
/// A tab's selection colours. This is deliberately separate from the global widget style:
/// application chrome, checkboxes, status colours and dialog actions retain their own tokens.
#[derive(Clone, Copy, Debug, PartialEq)]
@@ -85,12 +286,31 @@ impl TabAccent {
// Model and shared utility tabs retain their existing selection exactly.
_ => (t.accent, t.selected_ink, t.accent_soft),
};
+ let ink = if contrast_ratio(ink, soft) >= 4.5 {
+ ink
+ } else if contrast_ratio(color, soft) >= 4.5 {
+ color
+ } else if contrast_ratio(t.text, soft) >= 4.5 {
+ t.text
+ } else if contrast_ratio(Color32::BLACK, soft) >= contrast_ratio(Color32::WHITE, soft) {
+ Color32::BLACK
+ } else {
+ Color32::WHITE
+ };
Self { color, ink, soft }
}
/// Small text on a tab's solid pill. Brighter fills need dark ink in either theme.
pub fn on_fill(self, t: &Tokens) -> Color32 {
- if contrast_ratio(t.on_accent, self.color) >= 4.5 { t.on_accent } else { t.tab_on_fill_dark }
+ if contrast_ratio(t.on_accent, self.color) >= 4.5 {
+ t.on_accent
+ } else if contrast_ratio(t.tab_on_fill_dark, self.color) >= 4.5 {
+ t.tab_on_fill_dark
+ } else if contrast_ratio(Color32::BLACK, self.color) >= contrast_ratio(Color32::WHITE, self.color) {
+ Color32::BLACK
+ } else {
+ Color32::WHITE
+ }
}
pub fn current(ctx: &egui::Context) -> Self {
@@ -225,6 +445,8 @@ pub struct IconColors {
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Tokens {
+ /// Optional structural/control strokes. None retains each surface’s legacy styling.
+ pub borders: Borders,
/// File/start presentation, with explicit foreground/background pairs.
pub file_dim: Color32,
pub file_recovery_well: Color32,
@@ -526,12 +748,19 @@ pub struct Tokens {
pub continuity: [Color32; 4],
pub analysis: AnalysisColors,
pub icons: IconColors,
+ /// Optional SVG display roles and semantic ramps from the active theme file.
+ pub icon_palette: Option<crate::icon_svg::Palette>,
/// The SolidCraft mark on the application bar: light, mid and dark faces (the gaps between
/// them show the bar).
pub logo: [Color32; 3],
}
impl Tokens {
+ /// An expanded outline follows its fill, including a theme's deliberately square corners.
+ pub(crate) fn outset_radius(radius: f32, outset: f32) -> f32 {
+ if radius > 0.0 { radius + outset } else { 0.0 }
+ }
+
/// Subtle shell elevation, derived from the semantic application-bar colour.
pub(crate) fn shell_shadow(self) -> egui::Shadow {
egui::Shadow { offset: [0, self.space_2 as i8], blur: self.space_8 as u8, spread: 0, color: self.app_bar.gamma_multiply(0.18) }
@@ -590,7 +819,7 @@ fn visuals(dark: bool) -> egui::Visuals {
let mut v = if dark { egui::Visuals::dark() } else { egui::Visuals::light() };
v.panel_fill = t.panel;
v.window_fill = t.panel;
- v.window_stroke = Stroke::new(1.0, t.border);
+ v.window_stroke = t.primary_border(t.border);
v.extreme_bg_color = t.field;
v.faint_bg_color = t.panel_header;
v.override_text_color = Some(t.text);
@@ -599,14 +828,24 @@ fn visuals(dark: bool) -> egui::Visuals {
v.widgets.active.weak_bg_fill = t.accent_soft;
v.selection.bg_fill = t.accent_soft;
v.selection.stroke = Stroke::new(1.0, t.accent);
- v.widgets.noninteractive.bg_stroke = Stroke::new(1.0, t.border);
+ v.widgets.noninteractive.bg_stroke = t.tertiary_border(t.border);
v.widgets.noninteractive.fg_stroke = Stroke::new(1.0, t.text);
v.widgets.inactive.fg_stroke = Stroke::new(1.0, t.text);
v.widgets.hovered.weak_bg_fill = t.hover;
v.widgets.hovered.bg_fill = t.hover;
// egui uses the open-state fill for a movable window's active title bar.
v.widgets.open.weak_bg_fill = t.panel_header;
+ for state in [&mut v.widgets.inactive, &mut v.widgets.hovered, &mut v.widgets.active, &mut v.widgets.open] {
+ state.bg_stroke = t.borders.stroke(BorderRole::Control, state.bg_stroke);
+ }
v.window_corner_radius = egui::CornerRadius::same(t.radius_md);
+ v.menu_corner_radius = egui::CornerRadius::same(t.radius_md);
+ // Keep the existing 2/3 point egui shapes under the default 4 point small token.
+ // Set every interaction state so hovering or focusing cannot restore rounded corners.
+ for widget in [&mut v.widgets.noninteractive, &mut v.widgets.inactive, &mut v.widgets.active, &mut v.widgets.open] {
+ widget.corner_radius = egui::CornerRadius::same(t.radius_sm / 2);
+ }
+ v.widgets.hovered.corner_radius = egui::CornerRadius::same(t.radius_sm.saturating_sub(1));
v
}
@@ -623,6 +862,39 @@ pub fn apply(ctx: &egui::Context) {
#[cfg(test)]
mod tests {
+ #[test]
+ fn widget_states_and_popup_frames_follow_theme_radii_without_changing_defaults() {
+ use super::*;
+ let old_custom = CUSTOM.get();
+ for dark in [false, true] {
+ set_custom(None);
+ let actual = visuals(dark);
+ let original = if dark { egui::Visuals::dark() } else { egui::Visuals::light() };
+ assert_eq!(actual.menu_corner_radius, original.menu_corner_radius);
+ for (a, b) in [
+ (actual.widgets.noninteractive, original.widgets.noninteractive),
+ (actual.widgets.inactive, original.widgets.inactive),
+ (actual.widgets.hovered, original.widgets.hovered),
+ (actual.widgets.active, original.widgets.active),
+ (actual.widgets.open, original.widgets.open),
+ ] {
+ assert_eq!(a.corner_radius, b.corner_radius);
+ }
+ let tokens = Tokens { radius_sm: 0, radius_md: 0, ..Tokens::dark() };
+ set_custom(Some(Custom { dark, tokens }));
+ let square = visuals(dark);
+ set_custom(old_custom);
+ assert_eq!(square.window_corner_radius, egui::CornerRadius::ZERO);
+ assert_eq!(square.menu_corner_radius, egui::CornerRadius::ZERO);
+ for widget in [square.widgets.noninteractive, square.widgets.inactive, square.widgets.hovered, square.widgets.active, square.widgets.open]
+ {
+ assert_eq!(widget.corner_radius, egui::CornerRadius::ZERO);
+ }
+ }
+ assert_eq!(Tokens::outset_radius(0.0, 3.0), 0.0);
+ assert_eq!(Tokens::outset_radius(6.0, 3.0), 9.0);
+ }
+
#[test]
fn file_view_foreground_pairs_hold_small_text_contrast_without_changing_accent() {
for dark in [false, true] {
diff --git a/crates/ui-egui/src/theme_files.rs b/crates/ui-egui/src/theme_files.rs
index 3388a43e09..692f54d3c9 100644
--- a/crates/ui-egui/src/theme_files.rs
+++ b/crates/ui-egui/src/theme_files.rs
@@ -1,4 +1,4 @@
-//! Colour themes as files (#2255): a `solidcraft-theme/1` JSON file names a base palette (the
+//! Colour and shape themes as files (#2255): a `solidcraft-theme/1` JSON file names a base palette (the
//! built-in Dark or Light) and sets any of its [`Tokens`] by name, so a theme can be a handful of
//! lines. Built-in themes (Gruvbox and others) are such files under `assets/styles/ui/themes/`;
//! imported ones are kept in the preferences (`Prefs::custom_themes`), so they also work in the
@@ -68,7 +68,7 @@ impl Base {
}
}
-/// A theme: its id (the `theme` preference's value), name, base and colour overrides, each a
+/// A theme: its id (the `theme` preference's value), name, base, optional radii and colour overrides, each a
/// `#rrggbb` / `#rrggbbaa` string or a list of them, keyed by [`keys`].
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ThemeFile {
@@ -76,6 +76,166 @@ pub struct ThemeFile {
pub name: String,
pub base: Base,
pub colors: BTreeMap<String, Value>,
+ /// Optional corner radii in logical UI points. Missing entries keep the base values.
+ #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
+ pub radii: BTreeMap<String, u8>,
+ /// Optional border roles; absent entries retain the existing surface-specific styling.
+ #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
+ pub borders: BTreeMap<String, Value>,
+ /// SVG display roles and three-colour semantic ramps; omitted values keep compiled defaults.
+ #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
+ pub icon_palette: BTreeMap<String, Value>,
+}
+
+/// Maximum imported radius, in logical UI points; widgets clamp to their own bounds.
+const MAX_RADIUS: u8 = 32;
+const RADIUS_KEYS: [&str; 6] = ["radius_sm", "radius_md", "radius_lg", "radius_xl", "control_radius", "sketch_mode_radius"];
+
+fn radius_slot<'a>(t: &'a mut Tokens, key: &str) -> Option<&'a mut u8> {
+ match key {
+ "radius_sm" => Some(&mut t.radius_sm),
+ "radius_md" => Some(&mut t.radius_md),
+ "radius_lg" => Some(&mut t.radius_lg),
+ "radius_xl" => Some(&mut t.radius_xl),
+ "control_radius" => Some(&mut t.control_radius),
+ "sketch_mode_radius" => Some(&mut t.sketch_mode_radius),
+ _ => None,
+ }
+}
+
+impl ThemeFile {
+ /// Validate direct control-channel preference updates as strictly as file imports.
+ pub(crate) fn validate_radii(&self) -> Result<(), String> {
+ for (key, value) in &self.radii {
+ if !RADIUS_KEYS.contains(&key.as_str()) {
+ return Err(format!("`radii.{key}` is not a theme radius"));
+ }
+ if *value > MAX_RADIUS {
+ return Err(format!("`radii.{key}` must be an integer from 0 to {MAX_RADIUS}"));
+ }
+ }
+ Ok(())
+ }
+}
+
+/// Strictly bounded strokes shared by file imports and direct preference updates.
+pub(crate) fn parse_borders(values: &BTreeMap<String, Value>) -> Result<crate::theme::Borders, String> {
+ use crate::theme::{Bevel, Borders, InsetBorder};
+ if values.len() > 7 {
+ return Err("`borders` has more than seven roles".into());
+ }
+ let mut borders = Borders::default();
+ for (key, value) in values {
+ let obj = value.as_object().ok_or_else(|| format!("`borders.{key}` must be an object"))?;
+ if key == "bevel" {
+ if obj.keys().any(|k| !matches!(k.as_str(), "width" | "highlight" | "light" | "shadow" | "dark_shadow")) {
+ return Err("`borders.bevel` has an unknown setting".into());
+ }
+ let width = obj
+ .get("width")
+ .and_then(Value::as_f64)
+ .filter(|v| v.is_finite() && *v > 0.0 && *v <= 2.0)
+ .ok_or("`borders.bevel.width` must be a finite number greater than 0 and at most 2")? as f32;
+ let color = |name: &str| {
+ obj.get(name)
+ .and_then(Value::as_str)
+ .and_then(parse_color)
+ .ok_or_else(|| format!("`borders.bevel.{name}` must be #rrggbb or #rrggbbaa"))
+ };
+ borders.bevel = Some(Bevel {
+ width,
+ highlight: color("highlight")?,
+ light: color("light")?,
+ shadow: color("shadow")?,
+ dark_shadow: color("dark_shadow")?,
+ });
+ continue;
+ }
+ if obj.keys().any(|k| k != "color" && k != "width" && !(key == "primary_inset" && k == "gap") && !(key == "secondary" && k == "pattern")) {
+ return Err(format!("`borders.{key}` has an unknown setting"));
+ }
+ let number = |name: &str, max: f64| -> Result<f32, String> {
+ obj.get(name)
+ .and_then(Value::as_f64)
+ .filter(|v| v.is_finite() && *v >= 0.0 && *v <= max)
+ .map(|v| v as f32)
+ .ok_or_else(|| format!("`borders.{key}.{name}` must be a finite number from 0 to {max}"))
+ };
+ let width = number("width", 4.0)?;
+ let color = obj
+ .get("color")
+ .and_then(Value::as_str)
+ .and_then(parse_color)
+ .ok_or_else(|| format!("`borders.{key}.color` must be #rrggbb or #rrggbbaa"))?;
+ let stroke = egui::Stroke::new(width, color);
+ match key.as_str() {
+ "primary" => borders.primary = Some(stroke),
+ "secondary" => {
+ borders.secondary = Some(stroke);
+ borders.secondary_dotted = match obj.get("pattern") {
+ None => false,
+ Some(Value::String(pattern)) if pattern == "solid" => false,
+ Some(Value::String(pattern)) if pattern == "dotted" => true,
+ _ => return Err("`borders.secondary.pattern` must be solid or dotted".into()),
+ };
+ }
+ "tertiary" => borders.tertiary = Some(stroke),
+ "container" => borders.container = Some(stroke),
+ "control" => borders.control = Some(stroke),
+ "primary_inset" => borders.primary_inset = Some(InsetBorder { stroke, gap: number("gap", 12.0)? }),
+ _ => return Err(format!("`borders.{key}` is not a border role")),
+ }
+ }
+ Ok(borders)
+}
+
+/// Import only known, opaque SVG roles and bounded semantic ramps. GAP remains an eraser.
+pub(crate) fn parse_icon_palette(values: &BTreeMap<String, Value>) -> Result<Option<crate::icon_svg::Palette>, String> {
+ use crate::icon_svg::{ACCENT_NAMES, Palette, ROLE_NAMES};
+ if values.is_empty() {
+ return Ok(None);
+ }
+ if values.len() > ROLE_NAMES.len() + ACCENT_NAMES.len() + 1 {
+ return Err("too many icon palette entries".into());
+ }
+ let mut palette = Palette::default();
+ for (name, value) in values {
+ let ramp = if name == "solid" { Some(0) } else { ACCENT_NAMES.iter().position(|a| *a == name).map(|a| a + 1) };
+ let role = ROLE_NAMES.iter().position(|r| *r == name && *r != "gap");
+ if ramp.is_none() && role.is_none() {
+ return Err(format!("`icon_palette.{name}` is not an SVG role or semantic ramp"));
+ }
+ let colors = colors_of(value, if ramp.is_some() { 3 } else { 1 }).map_err(|e| format!("`icon_palette.{name}` {e}"))?;
+ if colors.iter().any(|c| c.a() != 255) {
+ return Err(format!("`icon_palette.{name}` must use opaque colours"));
+ }
+ let rgb = |c: &Color32| [c.r(), c.g(), c.b()];
+ if let Some(slot) = ramp.and_then(|r| palette.accents.get_mut(r)) {
+ if let [a, b, c] = colors.as_slice() {
+ *slot = Some([rgb(a), rgb(b), rgb(c)]);
+ }
+ } else if let Some((slot, color)) = role.and_then(|r| palette.roles.get_mut(r)).zip(colors.first()) {
+ *slot = Some(rgb(color));
+ }
+ }
+ Ok(Some(palette))
+}
+
+fn export_icon_palette(palette: Option<crate::icon_svg::Palette>) -> BTreeMap<String, Value> {
+ let mut out = BTreeMap::new();
+ let Some(palette) = palette else { return out };
+ let hex = |[r, g, b]: [u8; 3]| format!("#{r:02x}{g:02x}{b:02x}");
+ for (name, color) in crate::icon_svg::ROLE_NAMES.iter().zip(palette.roles) {
+ if let Some(rgb) = color {
+ out.insert((*name).into(), json!(hex(rgb)));
+ }
+ }
+ for (name, ramp) in std::iter::once("solid").chain(crate::icon_svg::ACCENT_NAMES.iter().copied()).zip(palette.accents) {
+ if let Some(colors) = ramp {
+ out.insert(name.into(), json!(colors.map(hex)));
+ }
+ }
+ out
}
/// The settable colours: a key, and where it lives in [`Tokens`]. `one` keys take a colour,
@@ -92,6 +252,17 @@ macro_rules! theme_keys {
k
}
+ /// Stable identity of resolved colours, including custom themes with the same base/id.
+ /// Share the token inventory with import/export so added colour tokens cannot be missed.
+ pub(crate) fn color_key(t: &Tokens) -> u64 {
+ use std::hash::{Hash, Hasher};
+ let mut h = std::collections::hash_map::DefaultHasher::new();
+ $(t.$one.hash(&mut h);)*
+ $(t.$many.hash(&mut h);)*
+ $(t.icons.$ione.hash(&mut h);)*
+ h.finish()
+ }
+
fn slot<'a>(t: &'a mut Tokens, key: &str) -> Option<&'a mut [Color32]> {
match key {
$(stringify!($one) => Some(std::slice::from_mut(&mut t.$one)),)*
@@ -106,7 +277,7 @@ macro_rules! theme_keys {
// Not colours: the hover lift is a grey step, the analysis colours belong to shaders.
let Tokens {
$($one: _,)* $($many: _,)*
- hover_face_lift: _, analysis: _, icons: _,
+ hover_face_lift: _, analysis: _, icons: _, borders: _, icon_palette: _,
file_action_height: _, file_back_height: _, file_recovery_icon: _, file_grid_gap: _,
file_nav_width: _, file_nav_height: _, file_tile_height: _, file_tile_icon: _, file_recent_height: _,
file_sample_image_height: _, file_content_inset_x: _, file_content_inset_y: _, file_section_gap: _, font_start_title: _,
@@ -175,8 +346,21 @@ fn colors_of(v: &Value, len: usize) -> Result<Vec<Color32>, String> {
list.into_iter().map(|c| c.as_str().and_then(parse_color).ok_or_else(|| format!("`{c}` is not a colour such as \"#282828\""))).collect()
}
+// The application mark now has three faces and no outline. Older theme exports and
+// saved preferences carry a fourth, retired outline colour; keep their face colours.
+fn colors_for_key(key: &str, value: &Value, len: usize) -> Result<Vec<Color32>, String> {
+ if key == "logo"
+ && len == 3
+ && let Value::Array(colors) = value
+ && colors.len() == 4
+ {
+ return colors_of(&Value::Array(colors.iter().take(len).cloned().collect()), len);
+ }
+ colors_of(value, len)
+}
+
/// A theme file's text, checked: the format tag, a name, a base and only known keys with valid
-/// colours. Nothing is taken from a file with any error; the message names every bad key.
+/// colours and bounded radii. Nothing is taken from a file with any error; the message names every bad key.
pub fn parse(text: &str) -> Result<ThemeFile, String> {
if text.len() > MAX_BYTES {
return Err(format!("a theme file is at most {} KiB", MAX_BYTES / 1024));
@@ -214,17 +398,49 @@ pub fn from_value(v: &Value) -> Result<ThemeFile, String> {
match slot(&mut probe, k) {
None => bad.push(format!("`{k}` is not a theme colour")),
Some(s) => {
- if let Err(e) = colors_of(c, s.len()) {
+ if let Err(e) = colors_for_key(k, c, s.len()) {
bad.push(format!("`{k}` {e}"));
}
}
}
}
+ let radii = match v.get("radii") {
+ None => BTreeMap::new(),
+ Some(Value::Object(values)) => {
+ if values.len() > RADIUS_KEYS.len() {
+ return Err(format!("`radii` has more than {} entries", RADIUS_KEYS.len()));
+ }
+ let mut radii = BTreeMap::new();
+ for (key, value) in values {
+ if !RADIUS_KEYS.contains(&key.as_str()) {
+ bad.push(format!("`radii.{key}` is not a theme radius"));
+ } else if let Some(n) = value.as_u64().filter(|n| *n <= u64::from(MAX_RADIUS)) {
+ radii.insert(key.clone(), n as u8);
+ } else {
+ bad.push(format!("`radii.{key}` must be an integer from 0 to {MAX_RADIUS}"));
+ }
+ }
+ radii
+ }
+ Some(_) => return Err("`radii` must be an object of radius names and values".into()),
+ };
if !bad.is_empty() {
bad.truncate(8);
return Err(bad.join("; "));
}
- Ok(ThemeFile { id: slug(name), name: name.to_string(), base, colors: src.into_iter().collect() })
+ let borders = match v.get("borders") {
+ None => BTreeMap::new(),
+ Some(Value::Object(values)) => values.iter().map(|(k, v)| (k.clone(), v.clone())).collect(),
+ Some(_) => return Err("`borders` must be an object of border roles".into()),
+ };
+ parse_borders(&borders)?;
+ let icon_palette = match v.get("icon_palette") {
+ None => BTreeMap::new(),
+ Some(Value::Object(values)) => values.iter().map(|(k, v)| (k.clone(), v.clone())).collect(),
+ Some(_) => return Err("`icon_palette` must be an object of SVG roles and ramps".into()),
+ };
+ parse_icon_palette(&icon_palette)?;
+ Ok(ThemeFile { id: slug(name), name: name.to_string(), base, colors: src.into_iter().collect(), radii, borders, icon_palette })
}
/// An id from a name: lower-case letters, digits and dashes.
@@ -241,17 +457,27 @@ fn slug(name: &str) -> String {
if s.is_empty() { "theme".into() } else { s }
}
-/// The theme's palette: its base with its colours on top. A colour the saved preferences hold
+/// The theme's tokens: its base with its colours and radii on top. A colour the saved preferences hold
/// that this version can't read (a hand edit) is skipped, never an error.
pub fn resolve(theme: &ThemeFile) -> Tokens {
let mut t = if theme.base.is_dark() { Tokens::dark() } else { Tokens::light() };
for (k, v) in &theme.colors {
if let Some(s) = slot(&mut t, k)
- && let Ok(c) = colors_of(v, s.len())
+ && let Ok(c) = colors_for_key(k, v, s.len())
{
s.copy_from_slice(&c);
}
}
+ for (key, value) in &theme.radii {
+ if *value <= MAX_RADIUS
+ && let Some(slot) = radius_slot(&mut t, key)
+ {
+ *slot = *value;
+ }
+ }
+ // Malformed hand-edited saved settings cannot introduce non-finite drawing geometry.
+ t.borders = parse_borders(&theme.borders).unwrap_or_default();
+ t.icon_palette = parse_icon_palette(&theme.icon_palette).unwrap_or_default();
t
}
@@ -265,7 +491,37 @@ pub fn export(name: &str, base: Base, t: &Tokens) -> Value {
colors.insert(k.to_string(), v);
}
}
- json!({"format": FORMAT, "name": name, "base": base, "colors": colors})
+ let radii: BTreeMap<_, _> = RADIUS_KEYS.into_iter().filter_map(|key| radius_slot(&mut t, key).map(|value| (key, *value))).collect();
+ let mut borders = serde_json::Map::new();
+ for (key, stroke) in [
+ ("primary", t.borders.primary),
+ ("secondary", t.borders.secondary),
+ ("tertiary", t.borders.tertiary),
+ ("container", t.borders.container),
+ ("control", t.borders.control),
+ ] {
+ if let Some(stroke) = stroke {
+ borders.insert(key.into(), json!({"width": stroke.width, "color": format_color(stroke.color)}));
+ }
+ }
+ if t.borders.secondary_dotted
+ && let Some(secondary) = borders.get_mut("secondary").and_then(Value::as_object_mut)
+ {
+ secondary.insert("pattern".into(), json!("dotted"));
+ }
+ if let Some(inset) = t.borders.primary_inset {
+ borders.insert("primary_inset".into(), json!({"width": inset.stroke.width, "color": format_color(inset.stroke.color), "gap": inset.gap}));
+ }
+ if let Some(bevel) = t.borders.bevel {
+ let shadow = format_color(bevel.shadow);
+ borders.insert(
+ "bevel".into(),
+ json!({"width": bevel.width, "highlight": format_color(bevel.highlight),
+ "light": format_color(bevel.light), "shadow": shadow, "dark_shadow": format_color(bevel.dark_shadow)}),
+ );
+ }
+ let icon_palette = export_icon_palette(t.icon_palette);
+ json!({"format": FORMAT, "name": name, "base": base, "colors": colors, "radii": radii, "borders": borders, "icon_palette": icon_palette})
}
/// The theme files that come with SolidCraft (original files; Gruvbox, Tokyo Night, Solarized, Nord, Nosferatu and Catppuccin map open-source palettes, MIT).
@@ -339,6 +595,134 @@ pub fn add(custom: &mut Vec<ThemeFile>, mut theme: ThemeFile) -> Result<String,
mod tests {
use super::*;
+ #[test]
+ fn border_roles_roundtrip_on_either_base_and_preserve_legacy_defaults() {
+ use crate::theme::{BorderRole, Borders};
+ let settings = json!({
+ "primary":{"width":4,"color":"#ffffff"}, "secondary":{"width":1.5,"color":"#aabbcc","pattern":"dotted"},
+ "container":{"width":1,"color":"#a8c8ed"},
+ "tertiary":{"width":0,"color":"#00000000"}, "control":{"width":0.5,"color":"#123456"},
+ "primary_inset":{"width":0.75,"color":"#ffffff80","gap":12}
+ });
+ for base in ["dark", "light"] {
+ let old = from_value(&json!({"format":FORMAT,"name":"Old","base":base})).unwrap();
+ assert_eq!(resolve(&old).borders, Borders::LEGACY);
+ let legacy = egui::Stroke::new(2.5, Color32::RED);
+ for role in [BorderRole::Primary, BorderRole::Secondary, BorderRole::Tertiary, BorderRole::Container, BorderRole::Control] {
+ assert_eq!(resolve(&old).borders.stroke(role, legacy), legacy);
+ }
+ let file = from_value(&json!({"format":FORMAT,"name":"New","base":base,"borders":settings})).unwrap();
+ let t = resolve(&file);
+ assert_eq!(t.primary_border(Color32::BLACK).width, 4.0);
+ assert!(t.borders.secondary_dotted);
+ assert_eq!(t.tertiary_border(Color32::WHITE).width, 0.0);
+ assert_eq!(t.control_border_stroke(Color32::WHITE).color, Color32::from_rgb(0x12, 0x34, 0x56));
+ assert_eq!(resolve(&from_value(&export("New", file.base, &t)).unwrap()), t);
+ assert_eq!(serde_json::from_value::<ThemeFile>(serde_json::to_value(&file).unwrap()).unwrap(), file);
+ }
+ let saved: ThemeFile = serde_json::from_value(json!({"id":"old","name":"Old","base":"dark","colors":{}})).unwrap();
+ assert!(saved.borders.is_empty());
+ let partial =
+ from_value(&json!({"format":FORMAT,"name":"Partial","base":"dark","borders":{"secondary":{"width":2,"color":"#ffffff"}}})).unwrap();
+ assert_eq!(resolve(&partial).primary_border(Color32::RED), egui::Stroke::new(1.0, Color32::RED));
+ }
+
+ #[test]
+ fn malformed_border_settings_are_refused_and_saved_settings_are_safe() {
+ for settings in [
+ json!([]),
+ json!({"unknown":{"width":1,"color":"#ffffff"}}),
+ json!({"primary":true}),
+ json!({"primary":{"width":-1,"color":"#ffffff"}}),
+ json!({"primary":{"width":4.1,"color":"#ffffff"}}),
+ json!({"primary":{"width":"1","color":"#ffffff"}}),
+ json!({"primary":{"width":1,"color":"white"}}),
+ json!({"primary":{"width":1,"color":"#ffffff","gap":1}}),
+ json!({"primary_inset":{"width":1,"color":"#ffffff","gap":13}}),
+ json!({"primary_inset":{"width":1,"color":"#ffffff"}}),
+ ] {
+ assert!(from_value(&json!({"format":FORMAT,"name":"Bad","base":"dark","borders":settings})).is_err(), "{settings}");
+ }
+ let file = ThemeFile { borders: BTreeMap::from([("primary".into(), json!({"width":1e100,"color":"#ffffff"}))]), ..Default::default() };
+ assert_eq!(resolve(&file).borders, crate::theme::Borders::LEGACY);
+ assert!(parse_borders(&BTreeMap::from([("primary".into(), json!({"width":null,"color":"#ffffff"}))])).is_err());
+ assert_eq!(resolve(find("blueprint", &[]).unwrap()).borders.primary.unwrap().color, Color32::WHITE);
+ for id in ["gruvbox-dark", "gruvbox-light", "gruvbox-dark-soft", "gruvbox-light-soft"] {
+ assert_eq!(resolve(find(id, &[]).unwrap()).borders, crate::theme::Borders::LEGACY);
+ }
+ }
+
+ #[test]
+ fn bevel_settings_roundtrip_and_reject_invalid_values() {
+ let bevel = json!({"width":1,"highlight":"#ffffff","light":"#dfdfdf","shadow":"#808080","dark_shadow":"#000000"});
+ for base in ["light", "dark"] {
+ let source = json!({"format":FORMAT,"name":"Beveled","base":base,"borders":{"bevel":bevel}});
+ let file = from_value(&source).unwrap();
+ let tokens = resolve(&file);
+ assert_eq!(resolve(&from_value(&export("Beveled", file.base, &tokens)).unwrap()), tokens);
+ assert_eq!(tokens.input_fill(), tokens.field);
+ for invalid in [json!(0), json!(-1), json!(2.1), json!("1"), Value::Null] {
+ let mut bad = source.clone();
+ bad["borders"]["bevel"]["width"] = invalid;
+ assert!(from_value(&bad).is_err());
+ }
+ for key in ["highlight", "light", "shadow", "dark_shadow"] {
+ let mut bad = source.clone();
+ bad["borders"]["bevel"][key] = json!("white");
+ assert!(from_value(&bad).is_err());
+ }
+ let mut bad = source;
+ bad["borders"]["bevel"]["extra"] = json!(true);
+ assert!(from_value(&bad).is_err());
+ }
+ for theme in builtin() {
+ assert_eq!(resolve(theme).borders.bevel.is_some(), theme.id == "solidcraft-95", "{}", theme.id);
+ }
+ }
+
+ #[test]
+ fn icon_palette_import_export_is_bounded_and_keeps_legacy_defaults() {
+ let source = json!({"format":FORMAT,"name":"Icons","base":"dark","icon_palette": {
+ "ink":"#123456", "line":"#abcdef", "solid":["#c0d0e0","#456789","#123456"],
+ "sketch":["#c0e0d0","#458967","#125634"] }});
+ let file = from_value(&source).unwrap();
+ let tokens = resolve(&file);
+ assert!(tokens.icon_palette.is_some());
+ assert_eq!(resolve(&from_value(&export("Icons", file.base, &tokens)).unwrap()), tokens);
+ for (key, value) in [
+ ("gap", json!("#ffffff")),
+ ("unknown", json!("#ffffff")),
+ ("ink", json!("#ffffff80")),
+ ("solid", json!(["#ffffff"])),
+ ("surface", json!(["#ffffff", "#ffffff", "no"])),
+ ] {
+ let mut bad = source.clone();
+ bad["icon_palette"][key] = value;
+ assert!(from_value(&bad).is_err(), "{bad}");
+ }
+ let old = from_value(&json!({"format":FORMAT,"name":"Legacy","base":"light"})).unwrap();
+ assert!(resolve(&old).icon_palette.is_none());
+ let damaged = ThemeFile { icon_palette: BTreeMap::from([("gap".into(), json!("#ffffff"))]), ..Default::default() };
+ assert!(resolve(&damaged).icon_palette.is_none());
+ }
+
+ #[test]
+ fn shipped_themes_have_readable_distinct_workspace_colours_and_icon_palettes() {
+ use crate::theme::{TabAccent, contrast_ratio};
+ assert_eq!(builtin().len(), BUILTIN.len(), "all shipped themes must be valid");
+ for file in builtin() {
+ let t = resolve(file);
+ assert!(t.icon_palette.is_some(), "{} has no icon palette", file.id);
+ let mut fills = std::collections::HashSet::new();
+ for tab in ["MODEL", "SURFACE", "MESH", "FORM", "SHEET METAL", "RENDER", "SKETCH"] {
+ let accent = TabAccent::for_tab(&t, tab);
+ assert!(fills.insert(accent.color), "{} repeats {tab}", file.id);
+ assert!(contrast_ratio(accent.ink, accent.soft) >= 4.5, "{} {tab} soft text", file.id);
+ assert!(contrast_ratio(accent.on_fill(&t), accent.color) >= 4.5, "{} {tab} pill text", file.id);
+ }
+ }
+ }
+
#[test]
fn built_in_themes_read_and_differ_from_their_base() {
assert_eq!(builtin().len(), BUILTIN.len(), "every built-in theme file reads");
@@ -366,11 +750,15 @@ mod tests {
let mut file = export("Older theme", Base::Dark, &Tokens::dark());
let colors = file.get_mut("colors").and_then(Value::as_object_mut).unwrap();
colors.insert("panel".into(), json!("#102030"));
+ colors.insert("logo".into(), json!(["#102030", "#405060", "#708090", "#000000"]));
for key in RETIRED_COLORS {
colors.insert((*key).into(), json!("#abcdef"));
}
let imported = from_value(&file).unwrap();
assert_eq!(resolve(&imported).panel, Color32::from_rgb(0x10, 0x20, 0x30));
+ let resolved = resolve(&imported);
+ assert_eq!(resolved.logo, [parse_color("#102030").unwrap(), parse_color("#405060").unwrap(), parse_color("#708090").unwrap()]);
+ assert_eq!(export("Current", Base::Dark, &resolved)["colors"]["logo"].as_array().unwrap().len(), 3);
assert_eq!(imported.colors.len(), keys().len());
assert!(RETIRED_COLORS.iter().all(|key| !imported.colors.contains_key(*key)));
}
@@ -438,4 +826,73 @@ mod tests {
assert!(add(&mut custom, mk("one too many")).is_err());
assert!(find("gruvbox-dark", &custom).is_some() && find("mine", &custom).is_some() && find("dark", &custom).is_none());
}
+
+ fn radius_values(mut tokens: Tokens) -> Vec<u8> {
+ RADIUS_KEYS.iter().map(|key| *radius_slot(&mut tokens, key).unwrap()).collect()
+ }
+
+ #[test]
+ fn optional_radii_preserve_old_files_and_saved_preferences() {
+ for base in [Base::Dark, Base::Light] {
+ let file = json!({"format": FORMAT, "name": "Old", "base": base});
+ let parsed = from_value(&file).unwrap();
+ let defaults = if base.is_dark() { Tokens::dark() } else { Tokens::light() };
+ assert_eq!(resolve(&parsed), defaults);
+ // Preferences serialize ThemeFile directly, without the export format wrapper.
+ let stored = json!({"id": "old", "name": "Old", "base": base, "colors": {}});
+ let old: ThemeFile = serde_json::from_value(stored).unwrap();
+ assert_eq!(resolve(&old), defaults);
+ let partial = from_value(&json!({"format": FORMAT, "name": "Partial", "base": base, "radii": {"control_radius": 0}})).unwrap();
+ assert_eq!(resolve(&partial), Tokens { control_radius: 0, ..defaults });
+ }
+ }
+
+ #[test]
+ fn every_radius_round_trips_through_export_and_preferences_on_either_base() {
+ for values in [[0; 6], [1, 2, 3, 4, 5, 6], [32; 6]] {
+ let mut tokens = Tokens::dark();
+ for (key, value) in RADIUS_KEYS.iter().zip(values) {
+ *radius_slot(&mut tokens, key).unwrap() = value;
+ }
+ for base in [Base::Dark, Base::Light] {
+ let parsed = from_value(&export("Shapes", base, &tokens)).unwrap();
+ let restored: ThemeFile = serde_json::from_value(serde_json::to_value(&parsed).unwrap()).unwrap();
+ assert_eq!(radius_values(resolve(&restored)), values);
+ assert_eq!(restored.radii.len(), RADIUS_KEYS.len());
+ }
+ }
+ }
+
+ #[test]
+ fn invalid_radii_are_refused_and_hand_edited_preferences_resolve_safely() {
+ for value in [json!(-1), json!(33), json!(256), json!(1.5), json!("4"), json!(null), json!(true), json!([4]), json!({})] {
+ let error = from_value(&json!({"format": FORMAT, "name": "Bad", "base": "dark", "radii": {"control_radius": value}})).unwrap_err();
+ assert!(error.contains("radii.control_radius"), "{error}");
+ }
+ assert!(from_value(&json!({"format": FORMAT, "name": "Bad", "base": "dark", "radii": []})).unwrap_err().contains("radii"));
+ let error = from_value(&json!({"format": FORMAT, "name": "Bad", "base": "dark", "radii": {"typo": 4, "radius_sm": -1}})).unwrap_err();
+ assert!(error.contains("radii.typo") && error.contains("radii.radius_sm"));
+ let hand_edited = ThemeFile { radii: BTreeMap::from([("radius_sm".into(), 255), ("typo".into(), 6)]), ..Default::default() };
+ assert_eq!(resolve(&hand_edited), Tokens::dark());
+ }
+
+ #[test]
+ fn built_in_shapes_match_their_character_and_light_dark_families_agree() {
+ let values = |id: &str| radius_values(resolve(find(id, &[]).unwrap()));
+ for id in ["platinum-9", "green-phosphor", "amber-phosphor"] {
+ assert_eq!(values(id), [0; 6], "{id}");
+ }
+ assert_eq!(values("solidcraft-95"), [3, 3, 4, 4, 3, 3]);
+ assert_eq!(values("blueprint"), [4, 6, 8, 10, 6, 7]);
+ assert_eq!(values("cupertino"), [6, 8, 12, 16, 8, 9]);
+ let defaults = radius_values(Tokens::dark());
+ assert_eq!(defaults, radius_values(Tokens::light()));
+ for suffix in ["", "-hard", "-soft"] {
+ assert_eq!(values(&format!("gruvbox-dark{suffix}")), defaults);
+ assert_eq!(values(&format!("gruvbox-light{suffix}")), defaults);
+ }
+ for file in builtin().iter().filter(|file| file.radii.is_empty()) {
+ assert_eq!(radius_values(resolve(file)), defaults, "{}", file.id);
+ }
+ }
}
diff --git a/crates/ui-egui/src/timeline.rs b/crates/ui-egui/src/timeline.rs
index 2c282a83c4..546e27898b 100644
--- a/crates/ui-egui/src/timeline.rs
+++ b/crates/ui-egui/src/timeline.rs
@@ -345,7 +345,7 @@ pub fn timeline(app: &mut SolveApp, ui: &mut egui::Ui) {
app.shell.history = Some(rect);
crate::scenario::publish_rect("history:card", rect);
let mut child = ui.new_child(UiBuilder::new().id_salt("sc_timeline").max_rect(rect));
- ui.painter().add(Container::new(ui.ctx(), Surface::Panel).frame(ui.ctx(), t.timeline, crate::frame::Side::Left).paint(rect));
+ Container::paint_frame(ui.painter(), Container::new(ui.ctx(), Surface::Panel).frame(ui.ctx(), t.timeline, crate::frame::Side::Left), rect);
child.set_clip_rect(rect);
timeline_contents(app, &mut child, true);
} else {
@@ -356,6 +356,8 @@ pub fn timeline(app: &mut SolveApp, ui: &mut egui::Ui) {
.show(ui, |ui| {
timeline_contents(app, ui, false);
});
+ let frame = Container::new(ui.ctx(), Surface::Panel).edge_frame(t.timeline);
+ Container::paint_inset(ui.painter(), response.response.rect - frame.outer_margin, frame);
app.shell.history = Some(response.response.rect);
crate::scenario::publish_rect("history:strip", response.response.rect);
}
diff --git a/crates/ui-egui/src/timeline_left.rs b/crates/ui-egui/src/timeline_left.rs
index bb5d13b940..3ac582c19b 100644
--- a/crates/ui-egui/src/timeline_left.rs
+++ b/crates/ui-egui/src/timeline_left.rs
@@ -257,7 +257,7 @@ pub fn left_timeline(app: &mut SolveApp, ui: &mut egui::Ui) {
{
return;
}
- ui.painter().hline(ui.max_rect().x_range(), ui.cursor().top(), Stroke::new(1.0, t.border));
+ t.secondary_hline(ui.painter(), ui.max_rect().x_range(), ui.cursor().top(), t.border);
ui.add_space(t.space_3);
egui::ScrollArea::vertical()
.id_salt("sc_left_timeline_scroll")
@@ -857,7 +857,11 @@ fn vertical_group_row(
drop_zones.push((rect, group.id));
slots.push(VerticalSlot { y: rect.bottom(), position: if open { position } else { end_position }, group: Some(group.id), indent_group: None });
if selected || response.hovered() {
- ui.painter().rect_filled(rect, 3.0, if selected { crate::theme::TabAccent::current(ui.ctx()).soft } else { t.hover });
+ ui.painter().rect_filled(
+ rect,
+ t.radius_sm.saturating_sub(1),
+ if selected { crate::theme::TabAccent::current(ui.ctx()).soft } else { t.hover },
+ );
}
let offset = if names { depth as f32 * 14.0 } else { 0.0 };
let centre = pos2(rect.left() + 9.0 + offset, rect.center().y);
@@ -1158,7 +1162,7 @@ fn vertical_features(app: &mut SolveApp, ui: &mut egui::Ui, names: bool) {
folder_drop_zones.iter().find(|(rect, group)| *group == target && rect.shrink2(vec2(0.0, 5.0)).contains(pointer)).map(|(rect, _)| *rect)
});
if let Some(rect) = hovered_folder {
- ui.painter().rect_stroke(rect.shrink(1.0), 3.0, Stroke::new(2.0, t.sketch_accent), egui::StrokeKind::Inside);
+ ui.painter().rect_stroke(rect.shrink(1.0), t.radius_sm.saturating_sub(1), Stroke::new(2.0, t.sketch_accent), egui::StrokeKind::Inside);
} else {
let left = vertical_drop_bar_left(ui.min_rect().left(), folder_target, &groups);
crate::ui_kit::history_drop_bar(
diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs
index 366e63f742..6c57a8ddde 100644
--- a/crates/ui-egui/src/toolbar.rs
+++ b/crates/ui-egui/src/toolbar.rs
@@ -257,10 +257,10 @@ pub(crate) fn offer_pill(
crate::scenario::publish_target(handle, rect);
let hot = response.hovered() || response.has_focus();
let fill = if hot { t.app_bar_hover_button } else { t.accent };
- let radius = PILL_HEIGHT / 2.0;
+ let radius = PILL_HEIGHT / 2.0 * f32::from(t.radius_xl) / 10.0;
ui.painter().rect_filled(rect, radius, fill);
if response.has_focus() {
- ui.painter().rect_stroke(rect.expand(2.0), radius + 2.0, Stroke::new(1.0, t.app_bar_text), egui::StrokeKind::Outside);
+ ui.painter().rect_stroke(rect.expand(2.0), Tokens::outset_radius(radius, 2.0), Stroke::new(1.0, t.app_bar_text), egui::StrokeKind::Outside);
}
let glyph_x = if label.is_some() { rect.left() + icon_x } else { rect.center().x };
let glyph = Rect::from_center_size(pos2(glyph_x, rect.center().y), vec2(16.0, 16.0));
@@ -596,7 +596,7 @@ fn file_menu(app: &mut SolveApp, ctx: &egui::Context) {
.fixed_pos(pos2(ctx.data(|d| d.get_temp::<f32>(egui::Id::new("sc_file_menu_x"))).unwrap_or(100.0), APP_BAR_HEIGHT))
.order(egui::Order::Foreground)
.show(ctx, |ui| {
- crate::ui_kit::Menu::frame().show(ui, |ui| {
+ crate::ui_kit::Menu::show_frame(ui, crate::ui_kit::Menu::frame(), |ui| {
ui.set_min_width(190.0);
ui.visuals_mut().widgets.inactive.weak_bg_fill = Color32::TRANSPARENT;
ui.visuals_mut().widgets.inactive.bg_stroke = Stroke::NONE;
@@ -911,7 +911,7 @@ fn ribbon_tabs(app: &mut SolveApp, ui: &mut egui::Ui, row: Rect) {
// edges, so their outer corners are concentric with the card's corners.
let floating = Container::for_layout(app.ui.layout, Surface::Panel).floating();
let inset = RIBBON_TAB_INSET;
- let corner = if floating { t.radius_lg.saturating_sub(inset as u8).max(2) } else { 5 };
+ let corner = if floating { t.radius_lg.saturating_sub(inset as u8).max(t.radius_sm / 2) } else { t.control_radius.saturating_sub(1) };
let search = Rect::from_min_size(pos2(row.right() - search_width - inset, row.top() + inset), vec2(search_width, TAB_ROW_HEIGHT - 2.0 * inset));
// The single editor is drawn on the foreground layer by shortcut_box::show, so it
// can grow over the ribbon without being clipped to the tab row.
@@ -997,9 +997,10 @@ fn ribbon_tabs(app: &mut SolveApp, ui: &mut egui::Ui, row: Rect) {
Stroke::new(2.0, panel_accent(&t, &app.ui.tab, "")),
);
} else {
- ui.painter().line_segment(
+ t.secondary_line(
+ ui.painter(),
[row.left_bottom() - vec2(0.0, 0.5), row.right_bottom() - vec2(0.0, 0.5)],
- Stroke::new(1.0, t.toolbar.lerp_to_gamma(t.border, 0.5)),
+ t.toolbar.lerp_to_gamma(t.border, 0.5),
);
}
}
@@ -1023,7 +1024,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let fill = if floating { Color32::TRANSPARENT } else { t.toolbar };
let ribbon = Container::new(ui.ctx(), Surface::Chrome).edge("sc_toolbar", Edge::Top);
let frame = Container::new(ui.ctx(), Surface::Chrome).edge_frame(fill);
- ribbon.exact_size(height).show_separator_line(false).frame(frame).show(ui, |ui| {
+ let chrome = ribbon.exact_size(height).show_separator_line(false).frame(frame).show(ui, |ui| {
let r = if floating { Rect::from_min_max(cards.workspace.min, cards.ribbon.max) } else { frame.outer_rect(ui.max_rect()) };
let ws = if floating { cards.workspace } else { Rect::from_min_size(r.left_top(), vec2(WORKSPACE_WIDTH, ribbon_height - 1.0)) };
let ribbon_left = if floating { cards.ribbon.left() } else { ws.right() };
@@ -1051,11 +1052,11 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let accent_inset = if floating { f32::from(t.radius_lg) } else { 0.0 };
painter.rect_filled(
Rect::from_min_size(ws.left_top() + vec2(accent_inset, 0.0), vec2((ws.width() - 2.0 * accent_inset).max(0.0), t.space_3)),
- egui::CornerRadius { nw: 0, ne: 0, sw: if floating { 2 } else { 0 }, se: if floating { 2 } else { 0 } },
+ egui::CornerRadius { nw: 0, ne: 0, sw: if floating { t.radius_sm / 2 } else { 0 }, se: if floating { t.radius_sm / 2 } else { 0 } },
t.accent,
);
if !floating {
- painter.line_segment([ws.right_top(), ws.right_bottom()], Stroke::new(1.0, t.border));
+ t.secondary_line(&painter, [ws.right_top(), ws.right_bottom()], t.border);
}
let render = crate::render_workspace::active(app);
let workspace_icon = if render { "ws_render" } else { "ws_design" };
@@ -1174,7 +1175,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let width = if finish { finish_width } else { plan.width() };
if finish && finish_right {
px = right - finish_width;
- painter.line_segment([pos2(px, top), pos2(px, r.bottom() - 1.0)], Stroke::new(1.0, t.border));
+ painter.line_segment([pos2(px, top), pos2(px, r.bottom() - 1.0)], t.tertiary_border(t.border));
}
let button_widths = &plan.widths;
let sketch_create = tab == "SKETCH" && *panel == "CREATE";
@@ -1314,9 +1315,10 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
if !collapsed && drawn > large.len() {
if !gallery.is_empty() {
// A quiet rule sets the grid apart from the large button before it.
- painter.line_segment(
+ t.secondary_line(
+ &painter,
[pos2(button_x - 1.5, top + 8.0), pos2(button_x - 1.5, top + button_height.min(46.0))],
- Stroke::new(1.0, t.toolbar.lerp_to_gamma(t.border, 0.5)),
+ t.toolbar.lerp_to_gamma(t.border, 0.5),
);
}
for (index, c) in gallery.iter().enumerate() {
@@ -1331,7 +1333,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let accent = crate::theme::TabAccent::for_tab(&t, &tab);
painter.rect(
cell,
- 4.0,
+ t.radius_sm,
if active {
if accent.color == t.accent { t.panel.lerp_to_gamma(command_accent(c.icon), 0.18) } else { accent.soft }
} else if resp.hovered() && info.enabled {
@@ -1386,7 +1388,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let accent = crate::theme::TabAccent::for_tab(&t, &tab);
let hot = lresp.hovered() && enabled_panel;
if panel_open || hot {
- painter.rect_filled(lr, 4.0, if panel_open { accent.soft } else { t.hover });
+ painter.rect_filled(lr, t.radius_sm, if panel_open { accent.soft } else { t.hover });
}
let label = if finish { app.tr("ui.ribbon_exit").to_string() } else { ribbon_label(app, panel) };
let font = if panel_open || hot {
@@ -1436,7 +1438,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let area = Container::new(ui.ctx(), Surface::Popup).area(popup_id).fixed_pos(lr.left_bottom()).order(egui::Order::Foreground).show(
ui.ctx(),
|ui| {
- section_frame(ui).show(ui, |ui| {
+ crate::ui_kit::Menu::show_frame(ui, crate::ui_kit::Menu::frame(), |ui| {
ui.spacing_mut().item_spacing.y = 0.0;
ui.set_min_width(200.0);
if *panel == "SELECT" {
@@ -1508,7 +1510,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
}
}
px += width;
- painter.line_segment([pos2(px, top + 4.0), pos2(px, top + group_height - 3.0)], Stroke::new(1.0, t.border));
+ painter.line_segment([pos2(px, top + 4.0), pos2(px, top + group_height - 3.0)], t.tertiary_border(t.border));
px += PANEL_GAP;
}
if !overflow.is_empty() {
@@ -1574,6 +1576,14 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
crate::context_menu::open_for(app, at, crate::context_menu::Target::ToolbarCommand { id: id.to_string() });
}
});
+ if floating {
+ let frame = Container::new(ui.ctx(), Surface::Chrome).frame(ui.ctx(), t.toolbar, crate::frame::Side::Left);
+ for card in [cards.workspace, cards.ribbon] {
+ Container::paint_inset(ui.painter(), frame.widget_rect(card), frame);
+ }
+ } else {
+ Container::paint_inset(ui.painter(), chrome.response.rect - frame.outer_margin, frame);
+ }
}
/// A short divider between the brand, file actions and document tabs.
@@ -1641,8 +1651,8 @@ fn ribbon_tooltip(app: &SolveApp, response: egui::Response, command: &solidcraft
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
egui::Frame::NONE
.fill(t.panel_header)
- .stroke(Stroke::new(1.0, t.border))
- .corner_radius(3.0)
+ .stroke(t.tertiary_border(t.border))
+ .corner_radius(t.radius_sm.saturating_sub(1))
.inner_margin(egui::Margin::symmetric(5, 1))
.show(ui, |ui| {
ui.label(egui::RichText::new(key).monospace().color(t.text_dim));
@@ -1668,10 +1678,6 @@ fn ribbon_tooltip(app: &SolveApp, response: egui::Response, command: &solidcraft
})
}
-fn section_frame(_ui: &egui::Ui) -> egui::Frame {
- crate::ui_kit::Menu::frame()
-}
-
fn section_heading(ui: &mut egui::Ui, label: &str, width: f32) {
let t = Tokens::get();
let (rect, _) = ui.allocate_exact_size(vec2(width, 24.0), Sense::hover());
@@ -1754,7 +1760,7 @@ fn dropdown_row(app: &SolveApp, ui: &mut egui::Ui, c: &'static solidcraft_engine
let p = ui.painter();
if pointer_on || resp.has_focus() {
if pin.hovered() {
- p.rect_filled(pr, 3.0, t.border.gamma_multiply(0.6));
+ p.rect_filled(pr, t.radius_sm.saturating_sub(1), t.border.gamma_multiply(0.6));
}
pin_icon(p, pr, pinned, if pinned { t.accent } else { t.text_dim });
crate::scenario::publish_handle(&format!("dropdown_pin:{}", c.id), pr.center());
diff --git a/crates/ui-egui/src/ui_kit/actions.rs b/crates/ui-egui/src/ui_kit/actions.rs
index f752f06d8f..8828f57abf 100644
--- a/crates/ui-egui/src/ui_kit/actions.rs
+++ b/crates/ui-egui/src/ui_kit/actions.rs
@@ -115,14 +115,26 @@ pub(super) fn footer_with_left(
egui::CornerRadius { nw: 0, ne: 0, sw: corners.sw.saturating_sub(1), se: corners.se.saturating_sub(1) },
t.dialog_footer,
);
- ui.painter().hline(band.x_range(), band.top(), egui::Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), band.x_range(), band.top(), t.dialog_rule);
scenario::publish_rect("dialog:footer", band);
scenario::publish_count("dialog:ok:enabled", f64::from(ok_enabled && ui.is_enabled()));
let inner = band.shrink2(vec2(t.space_12, t.space_10));
scenario::publish_rect("dialog:footer:actions", inner);
let mut action = if ui.is_enabled() { keyboard(ui.ctx(), ok_enabled) } else { Action::None };
- let primary_fill = if danger { t.form_error } else { t.form_primary };
- let primary_ink = if danger && crate::theme::contrast_ratio(t.on_accent, primary_fill) < 4.5 { t.tab_on_fill_dark } else { t.on_accent };
+ let primary_fill = if t.borders.bevel.is_some() && !danger {
+ t.control_fill
+ } else if danger {
+ t.form_error
+ } else {
+ t.form_primary
+ };
+ let primary_ink = if t.borders.bevel.is_some() && !danger {
+ t.form_ink
+ } else if danger && crate::theme::contrast_ratio(t.on_accent, primary_fill) < 4.5 {
+ t.tab_on_fill_dark
+ } else {
+ t.on_accent
+ };
let mut actions_left = inner.right();
let row = ui.scope_builder(egui::UiBuilder::new().max_rect(inner).layout(egui::Layout::left_to_right(egui::Align::Center)), |ui| {
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
@@ -153,14 +165,18 @@ pub(super) fn footer_with_left(
} else {
t.control_fill
})
- .stroke(egui::Stroke::new(
- if primary && ok_enabled { 0.0 } else { 1.0 },
- if marked && !primary { t.form_primary } else { t.control_border },
- ))
+ .stroke(if primary && ok_enabled {
+ egui::Stroke::NONE
+ } else if marked && !primary {
+ egui::Stroke::new(1.0, t.form_primary)
+ } else {
+ t.control_border_stroke(t.control_border)
+ })
.wrap_mode(egui::TextWrapMode::Extend)
.corner_radius(t.control_radius)
.min_size(vec2(if primary { t.space_24 * 3.0 } else { 0.0 }, t.form_button_height)),
);
+ t.button_bevel(ui, &response, false);
pointer_on_hover(ui, &response);
actions_left = actions_left.min(response.rect.left());
let key = match kind {
@@ -219,7 +235,7 @@ pub(crate) struct PairButton<'a> {
/// Equal-width secondary actions with optional icons and selected state. Tokens: `form_button_height, control_*, selected_bg, hover, font_label, text, icon/fill, accent, sketch_footer_icon_size, space_4/6/10`.
pub(crate) fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], buttons: [PairButton<'_>; 2]) -> (bool, bool) {
let t = Tokens::get();
- ui.painter().hline(ui.max_rect().x_range(), ui.cursor().top(), egui::Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), ui.max_rect().x_range(), ui.cursor().top(), t.dialog_rule);
let mut clicked = [false; 2];
egui::Frame::NONE.inner_margin(egui::Margin::symmetric(t.space_10 as i8, t.space_6 as i8)).show(ui, |ui| {
ui.horizontal(|ui| {
@@ -238,7 +254,7 @@ pub(crate) fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], butto
} else {
t.control_fill
},
- egui::Stroke::new(1.0, t.control_border),
+ t.control_border_stroke(t.control_border),
egui::StrokeKind::Inside,
);
let label = crate::i18n::tr_label(button.label);
@@ -259,6 +275,7 @@ pub(crate) fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], butto
}
painter.galley(egui::pos2(left + icon_width, rect.center().y - galley.size().y / 2.0), galley, t.form_ink);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, ui.is_enabled(), on, label));
+ t.button_bevel(ui, &response, on);
pointer_on_hover(ui, &response);
crate::scenario::publish_target(&format!("{key}:{}", button.key), rect);
if let Some(value) = clicked.get_mut(index) {
@@ -283,6 +300,10 @@ pub enum Button {
fn button_widget(label: egui::WidgetText, options: Button) -> egui::Button<'static> {
let t = Tokens::get();
+ if t.borders.bevel.is_some() && !matches!(options, Button::Ghost) {
+ let button = egui::Button::new(label.color(t.form_ink)).fill(t.control_fill).stroke(t.control_border_stroke(t.control_border));
+ return if matches!(options, Button::Small | Button::SmallSelected) { button.small() } else { button };
+ }
match options {
Button::Small => egui::Button::new(label).small(),
Button::Primary => {
@@ -304,6 +325,9 @@ pub fn button(ui: &mut Ui, label: impl Into<egui::WidgetText>, options: Button)
Button::Enabled(enabled) => ui.add_enabled_ui(enabled, |ui| ui.add(button_widget(crate::i18n::tr_label(&key).into(), options))).inner,
_ => ui.add(button_widget(label, options)),
};
+ if !matches!(options, Button::Ghost) {
+ Tokens::get().button_bevel(ui, &response, matches!(options, Button::SmallSelected));
+ }
pointer_on_hover(ui, &response);
let key = if matches!(options, Button::Enabled(_)) { crate::i18n::tr_label(&key) } else { &key };
publish_button(ui, &response, key);
@@ -329,6 +353,9 @@ pub(crate) fn button_at(ui: &mut Ui, id: &str, rect: egui::Rect, label: impl Int
},
)
.inner;
+ if !matches!(options, Button::Ghost) {
+ Tokens::get().button_bevel(ui, &response, matches!(options, Button::SmallSelected));
+ }
pointer_on_hover(ui, &response);
publish_button(ui, &response, &key);
response
@@ -346,9 +373,14 @@ pub(crate) fn primary_button(ui: &mut Ui, label: &str) -> Response {
/// `form_primary, on_accent, form_button_height, font_label`.
pub(crate) fn wide_primary_button(ui: &mut Ui, label: &str) -> Response {
let t = Tokens::get();
- let text = RichText::new(crate::i18n::tr_label(label)).size(t.font_label).color(t.on_accent);
+ let text = RichText::new(crate::i18n::tr_label(label)).size(t.font_label).color(if t.borders.bevel.is_some() { t.form_ink } else { t.on_accent });
let size = vec2(ui.available_width(), t.form_button_height);
- let response = ui.add(egui::Button::new(crate::fonts::RichTextExt::bold_face(text)).fill(t.form_primary).min_size(size));
+ let response = ui.add(
+ egui::Button::new(crate::fonts::RichTextExt::bold_face(text))
+ .fill(if t.borders.bevel.is_some() { t.control_fill } else { t.form_primary })
+ .min_size(size),
+ );
+ t.button_bevel(ui, &response, false);
pointer_on_hover(ui, &response);
response
}
@@ -423,7 +455,7 @@ pub(crate) fn icon_label_button(ui: &mut Ui, label: &str, icon: &str, enabled: b
rect,
t.control_radius,
if response.hovered() { t.hover } else { t.control_fill },
- egui::Stroke::new(1.0, t.control_border),
+ t.control_border_stroke(t.control_border),
egui::StrokeKind::Inside,
);
let icon_rect =
diff --git a/crates/ui-egui/src/ui_kit/assistant.rs b/crates/ui-egui/src/ui_kit/assistant.rs
index f6e162d4e1..486f42be7e 100644
--- a/crates/ui-egui/src/ui_kit/assistant.rs
+++ b/crates/ui-egui/src/ui_kit/assistant.rs
@@ -51,7 +51,7 @@ pub(crate) fn assistant_header<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -
ui.set_min_height(t.form_close_size);
add(ui)
});
- ui.painter().hline(output.response.rect.x_range(), output.response.rect.bottom(), egui::Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), output.response.rect.x_range(), output.response.rect.bottom(), t.dialog_rule);
output
}
@@ -76,7 +76,7 @@ pub(crate) fn assistant_bubble<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -
ui.add_space(width - bubble_width);
egui::Frame::NONE
.fill(t.accent_soft)
- .corner_radius(egui::CornerRadius { nw: t.radius_xl, ne: t.radius_xl, sw: t.radius_xl, se: t.space_3 as u8 })
+ .corner_radius(egui::CornerRadius { nw: t.radius_xl, ne: t.radius_xl, sw: t.radius_xl, se: t.radius_sm.saturating_sub(1) })
.inner_margin(egui::Margin::symmetric((t.space_8 + t.space_3) as i8, t.space_8 as i8))
.show(ui, |ui| {
let content_width = (bubble_width - (t.space_8 + t.space_3) * 2.0).max(0.0);
@@ -156,7 +156,7 @@ pub(crate) fn assistant_tool_frame<R>(ui: &mut Ui, failed: bool, add: impl FnOnc
let t = Tokens::get();
egui::Frame::NONE
.fill(if failed { t.form_error_fill } else { t.dialog_body })
- .stroke(egui::Stroke::new(1.0, t.dialog_rule))
+ .stroke(t.container_border(t.dialog_rule))
.corner_radius(t.radius_lg)
.inner_margin(t.space_3)
.show(ui, |ui| {
@@ -178,7 +178,7 @@ pub(crate) fn assistant_tool_detail<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) ->
let t = Tokens::get();
egui::Frame::NONE
.fill(t.control_fill)
- .stroke(egui::Stroke::new(1.0, t.dialog_rule))
+ .stroke(t.container_border(t.dialog_rule))
.corner_radius(t.control_radius)
.inner_margin(egui::Margin::symmetric((t.space_6 + t.space_3) as i8, t.space_6 as i8))
.show(ui, add)
@@ -251,7 +251,7 @@ pub(crate) fn assistant_composer<R>(ui: &mut Ui, focused: bool, add: impl FnOnce
let t = Tokens::get();
egui::Frame::NONE
.fill(t.control_fill)
- .stroke(egui::Stroke::new(1.0, if focused { t.form_primary } else { t.control_border }))
+ .stroke(if focused { egui::Stroke::new(1.0, t.form_primary) } else { t.control_border_stroke(t.control_border) })
.corner_radius(t.radius_xl)
.inner_margin(egui::Margin::symmetric(t.space_10 as i8, t.space_8 as i8))
.show(ui, |ui| {
@@ -293,7 +293,7 @@ pub(crate) fn assistant_composer_footer<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui
.corner_radius(egui::CornerRadius { nw: 0, ne: 0, sw: t.radius_xl.saturating_sub(1), se: t.radius_xl.saturating_sub(1) })
.inner_margin(t.space_10)
.show(ui, add);
- ui.painter().hline(output.response.rect.x_range(), output.response.rect.top(), egui::Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), output.response.rect.x_range(), output.response.rect.top(), t.dialog_rule);
output
}
@@ -321,7 +321,7 @@ pub(crate) fn assistant_empty<R>(ui: &mut Ui, title: &str, body: &str, add: impl
pub(crate) fn assistant_banner<R>(ui: &mut Ui, tone: AssistantTone, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {
let t = Tokens::get();
let (_, fill) = tone.colors(&t);
- egui::Frame::NONE.fill(fill).stroke(egui::Stroke::new(1.0, t.dialog_rule)).corner_radius(t.radius_lg).inner_margin(t.space_10).show(ui, |ui| {
+ egui::Frame::NONE.fill(fill).stroke(t.container_border(t.dialog_rule)).corner_radius(t.radius_lg).inner_margin(t.space_10).show(ui, |ui| {
ui.set_min_width(ui.available_width().max(0.0));
ui.spacing_mut().item_spacing.y = t.space_8;
add(ui)
diff --git a/crates/ui-egui/src/ui_kit/assistant_entry.rs b/crates/ui-egui/src/ui_kit/assistant_entry.rs
index 80e6f2fd22..5bf5fac7c4 100644
--- a/crates/ui-egui/src/ui_kit/assistant_entry.rs
+++ b/crates/ui-egui/src/ui_kit/assistant_entry.rs
@@ -59,8 +59,8 @@ pub(crate) fn assistant_entry(ui: &egui::Ui, response: &Response, state: Assista
let font = FontId::proportional(t.font_badge);
let galley = ui.painter().layout_no_wrap(text, font, t.app_bar);
let badge = Rect::from_center_size(c, vec2((galley.size().x + t.space_6).max(t.space_14), t.space_14));
- ui.painter().rect_filled(badge.expand(1.5), 8.5, ring);
- ui.painter().rect_filled(badge, 7.0, t.warning);
+ ui.painter().rect_filled(badge.expand(1.5), Tokens::outset_radius(f32::from(t.sketch_mode_radius), 1.5), ring);
+ ui.painter().rect_filled(badge, t.sketch_mode_radius, t.warning);
ui.painter().galley(badge.center() - galley.size() / 2.0, galley, t.app_bar);
}
}
diff --git a/crates/ui-egui/src/ui_kit/checks.rs b/crates/ui-egui/src/ui_kit/checks.rs
index bb42827e46..e17bd2c47e 100644
--- a/crates/ui-egui/src/ui_kit/checks.rs
+++ b/crates/ui-egui/src/ui_kit/checks.rs
@@ -23,16 +23,27 @@ pub(super) fn paint_box(ui: &Ui, square: Rect, response: &Response, on: bool, mi
let t = Tokens::get();
let selected = on || mixed;
let border = if selected || response.hovered() || response.has_focus() { t.form_primary } else { t.control_border };
- let fill = if selected {
+ let fill = if t.borders.bevel.is_some() {
+ t.input_fill()
+ } else if selected {
t.form_primary
} else if response.hovered() {
t.hover
} else {
t.control_fill
};
- ui.painter().rect(square, t.radius_sm, fill, egui::Stroke::new(1.0, border), egui::StrokeKind::Inside);
+ ui.painter().rect(
+ square,
+ t.radius_sm,
+ fill,
+ if selected || response.hovered() || response.has_focus() { egui::Stroke::new(1.0, border) } else { t.control_border_stroke(border) },
+ egui::StrokeKind::Inside,
+ );
+ if let Some(bevel) = t.borders.bevel {
+ bevel.paint(ui.painter(), square, t.radius_sm, true, response.enabled());
+ }
if selected {
- paint_check_glyph(ui.painter(), square, mixed, t.on_accent);
+ paint_check_glyph(ui.painter(), square, mixed, if t.borders.bevel.is_some() { t.form_ink } else { t.on_accent });
}
if response.has_focus() {
ui.painter().rect_stroke(square.expand(t.space_2), t.radius_sm, egui::Stroke::new(1.0, t.form_primary), egui::StrokeKind::Outside);
diff --git a/crates/ui-egui/src/ui_kit/choice.rs b/crates/ui-egui/src/ui_kit/choice.rs
index a3bc35a7b5..c1d03be560 100644
--- a/crates/ui-egui/src/ui_kit/choice.rs
+++ b/crates/ui-egui/src/ui_kit/choice.rs
@@ -75,7 +75,7 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], con
);
}
if index > 0 {
- ui.painter().vline(segment.left(), segment.y_range(), egui::Stroke::new(1.0, t.control_border));
+ ui.painter().vline(segment.left(), segment.y_range(), t.control_border_stroke(t.control_border));
}
let font = if on { crate::fonts::semibold(t.font_label) } else { egui::FontId::proportional(t.font_label) };
let galley = ui.painter().layout_no_wrap((*option).to_string(), font.clone(), t.form_ink);
@@ -96,6 +96,7 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], con
},
false,
);
+ t.button_bevel_with_radius(ui, &response, on, rounding);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, ui.is_enabled(), on, *option));
scenario::publish_handle(&format!("dialog:{}:{option}", label(ui)), segment.center());
if response.on_hover_text(*option).clicked() {
@@ -103,7 +104,9 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], con
clicked = true;
}
}
- ui.painter().rect_stroke(rect, t.control_radius, egui::Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
+ if t.borders.bevel.is_none() {
+ ui.painter().rect_stroke(rect, t.control_radius, t.control_border_stroke(t.control_border), egui::StrokeKind::Inside);
+ }
scenario::publish_target_as(&format!("dialog:{}", label(ui)), &format!("dialog:segments:{}", label(ui)), rect);
clicked
}
@@ -140,12 +143,13 @@ pub(crate) fn segmented_icons(ui: &mut Ui, selected: &mut usize, options: &[Icon
ui.painter().rect_filled(segment, rounding, if on { t.selected_bg } else { t.hover });
}
if index > 0 {
- ui.painter().vline(segment.left(), segment.y_range(), egui::Stroke::new(1.0, t.control_border));
+ ui.painter().vline(segment.left(), segment.y_range(), t.control_border_stroke(t.control_border));
}
// A square icon area inside the segment: dash gaps and dots need the room to read apart.
let side = (segment.width().min(segment.height()) - t.space_4).max(t.space_12);
let icon_rect = egui::Rect::from_center_size(segment.center(), vec2(side, side));
crate::icons::paint_icon(ui.painter(), icon_rect, option.icon, f32::from(t.icon.a()) / 255.0);
+ t.button_bevel_with_radius(ui, &response, on, rounding);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, ui.is_enabled(), on, option.key));
scenario::publish_handle(&format!("dialog:{}:{}", label(ui), option.key), segment.center());
let response = response.on_hover_text(&option.tip);
@@ -154,7 +158,9 @@ pub(crate) fn segmented_icons(ui: &mut Ui, selected: &mut usize, options: &[Icon
clicked = true;
}
}
- ui.painter().rect_stroke(rect, t.control_radius, egui::Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
+ if t.borders.bevel.is_none() {
+ ui.painter().rect_stroke(rect, t.control_radius, t.control_border_stroke(t.control_border), egui::StrokeKind::Inside);
+ }
scenario::publish_target_as(&format!("dialog:{}", label(ui)), &format!("dialog:segments:{}", label(ui)), rect);
clicked
}
@@ -250,11 +256,12 @@ pub(crate) fn tool_choices<'a>(ui: &mut Ui, label: &str, current: &str, choices:
enabled,
egui::Button::new("")
.fill(fill)
- .stroke(egui::Stroke::new(if on { t.sketch_mode_border } else { 1.0 }, if on { t.sketch_accent } else { t.control_border }))
+ .stroke(if on { egui::Stroke::new(t.sketch_mode_border, t.sketch_accent) } else { t.control_border_stroke(t.control_border) })
.corner_radius(t.sketch_mode_radius)
.min_size(vec2(t.sketch_mode_size, t.sketch_mode_size)),
);
crate::icons::paint_icon(ui.painter(), response.rect.shrink(t.space_6), choice.icon, f32::from(t.icon.a()) / 255.0);
+ t.button_bevel(ui, &response, on);
scenario::publish_target(&format!("sketch_palette:feature:{}", choice.key), response.rect);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, enabled, on, choice.label));
if response.on_hover_text(choice.label).clicked() && enabled {
@@ -274,6 +281,7 @@ pub(crate) fn toggle_icon(ui: &mut Ui, row: &str, label: &str, selected: &mut bo
ui.add(egui::Button::new("").selected(*selected).min_size(vec2(t.space_24 + t.space_4, t.control_height)).sense(egui::Sense::CLICK));
crate::icons::paint_icon(ui.painter(), response.rect.shrink(t.space_3), icon, f32::from(t.icon.a()) / 255.0);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, true, *selected, crate::i18n::tr_label(label)));
+ t.button_bevel(ui, &response, *selected);
crate::scenario::publish_handle(&format!("dialog:{row}:{label}"), response.rect.center());
if response.clone().on_hover_text(crate::i18n::tr_label(label)).clicked() {
*selected = !*selected;
@@ -329,7 +337,7 @@ pub(crate) fn color_swatch<T: Send + Sync + 'static>(
}
}
}
- ui.painter().rect(rect, t.control_radius, color, egui::Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
+ ui.painter().rect(rect, t.control_radius, color, t.control_border_stroke(t.border), egui::StrokeKind::Inside);
})
.response;
let response = ui.interact(response.rect, id.with("click"), egui::Sense::click()).on_hover_text(tip);
@@ -382,7 +390,7 @@ pub(crate) fn popup_list(
let area = popup.order(egui::Order::Tooltip).fixed_pos(anchor.left_bottom() + egui::vec2(0.0, t.space_2)).show(ctx, |ui| {
Container::popup_frame(ui.style())
.fill(t.control_fill)
- .stroke(egui::Stroke::new(1.0, t.dialog_border))
+ .stroke(t.primary_border(t.dialog_border))
.corner_radius(t.radius_lg)
.inner_margin(t.space_4)
.show(ui, |ui| {
@@ -444,7 +452,7 @@ pub(crate) fn color_thumbnail<T: Send + Sync + 'static>(ui: &mut Ui, id: egui::I
let t = Tokens::get();
ui.dnd_drag_source(id, payload, |ui| {
let (rect, _) = ui.allocate_exact_size(vec2(t.space_16, t.space_16), egui::Sense::hover());
- ui.painter().rect(rect, t.radius_sm, color, egui::Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
+ ui.painter().rect(rect, t.radius_sm, color, t.control_border_stroke(t.border), egui::StrokeKind::Inside);
})
.response
.on_hover_text(tip)
diff --git a/crates/ui-egui/src/ui_kit/choice_tests.rs b/crates/ui-egui/src/ui_kit/choice_tests.rs
index 913ee95d08..6d2a024d21 100644
--- a/crates/ui-egui/src/ui_kit/choice_tests.rs
+++ b/crates/ui-egui/src/ui_kit/choice_tests.rs
@@ -43,3 +43,47 @@ fn optional_field_keeps_empty_default_and_options_use_two_columns() {
frame(&ctx, pointer(first, false), &mut draw);
assert!(flip && copy);
}
+
+#[test]
+fn beveled_segments_share_fill_corners_at_internal_joins() {
+ use crate::theme::Tokens;
+ use egui::{Color32, Shape};
+ let mut t = Tokens::light();
+ t.control_radius = 8;
+ t.borders.bevel = Some(crate::theme::Bevel {
+ width: 0.5,
+ highlight: Color32::WHITE,
+ light: Color32::LIGHT_GRAY,
+ shadow: Color32::GRAY,
+ dark_shadow: Color32::BLACK,
+ });
+ let _restore = crate::theme::scoped_tokens(t);
+ for selected in 0..3 {
+ let ctx = crate::fonts::test_context();
+ let mut selected = selected;
+ let output = crate::test_support::frame(&ctx, egui::RawInput::default(), |ui| {
+ ui.set_width(300.0);
+ segmented(ui, &mut selected, &["Left", "Middle", "Right"], Default::default());
+ });
+ let fill = output
+ .shapes
+ .iter()
+ .find_map(|s| match &s.shape {
+ Shape::Rect(r) if r.fill == t.selected_bg => Some(r),
+ _ => None,
+ })
+ .expect("selected segment fill");
+ for edge in [fill.rect.left(), fill.rect.right()] {
+ let internal = if edge == fill.rect.left() { selected > 0 } else { selected < 2 };
+ if internal {
+ // A rounded bevel used to curve away while selection filled the square
+ // internal corner. Its top band must now reach the segment join.
+ assert!(output.shapes.iter().any(|s| match &s.shape {
+ Shape::LineSegment { points, .. } =>
+ points.iter().any(|p| (p.y - fill.rect.top() - 0.25).abs() < 0.01 && (p.x - edge).abs() <= 0.26),
+ _ => false,
+ }));
+ }
+ }
+ }
+}
diff --git a/crates/ui-egui/src/ui_kit/color.rs b/crates/ui-egui/src/ui_kit/color.rs
index 8ac77c2ca5..051027551e 100644
--- a/crates/ui-egui/src/ui_kit/color.rs
+++ b/crates/ui-egui/src/ui_kit/color.rs
@@ -17,7 +17,7 @@ pub(crate) fn color_field(ui: &mut Ui, rgb: &mut [u8; 3]) -> Response {
rect,
t.control_radius,
crate::theme::srgb(rgb.map(|c| f32::from(c) / 255.0)),
- egui::Stroke::new(1.0, t.control_border),
+ t.control_border_stroke(t.control_border),
egui::StrokeKind::Inside,
);
response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::ColorButton, ui.is_enabled(), i18n::tr("color.edit")));
@@ -30,7 +30,7 @@ pub(crate) fn color_field(ui: &mut Ui, rgb: &mut [u8; 3]) -> Response {
.frame(
Container::popup_frame(ui.style())
.fill(t.control_fill)
- .stroke(egui::Stroke::new(1.0, t.border))
+ .stroke(t.control_border_stroke(t.border))
.corner_radius(t.radius_xl)
.inner_margin(t.space_12),
)
@@ -165,7 +165,7 @@ pub(crate) fn color_popover(ui: &mut Ui, rgb: &mut [u8; 3]) -> bool {
strip,
t.control_radius,
crate::theme::srgb(rgb.map(|c| f32::from(c) / 255.0)),
- egui::Stroke::new(1.0, t.control_border),
+ t.control_border_stroke(t.control_border),
egui::StrokeKind::Inside,
);
publish("color:current", &response);
@@ -210,7 +210,12 @@ fn gradient(ui: &Ui, rect: egui::Rect, color: impl Fn(f32, f32) -> Color32) {
}
}
ui.painter().add(egui::Shape::mesh(mesh));
- ui.painter().rect_stroke(rect, Tokens::get().control_radius, egui::Stroke::new(1.0, Tokens::get().control_border), egui::StrokeKind::Inside);
+ ui.painter().rect_stroke(
+ rect,
+ Tokens::get().control_radius,
+ Tokens::get().control_border_stroke(Tokens::get().control_border),
+ egui::StrokeKind::Inside,
+ );
}
#[cfg(test)]
diff --git a/crates/ui-egui/src/ui_kit/container.rs b/crates/ui-egui/src/ui_kit/container.rs
index 8432e90afe..518f1a0a83 100644
--- a/crates/ui-egui/src/ui_kit/container.rs
+++ b/crates/ui-egui/src/ui_kit/container.rs
@@ -96,16 +96,16 @@ impl Container {
match self.surface {
Surface::Feature | Surface::Palette if !self.floating() => {
let edges = self.joined.unwrap_or(DockEdges { left: side == Side::Left, right: side == Side::Right, ..Default::default() });
- Self::compact_frame(fill, t.dialog_border, edges)
+ Self::compact_frame(fill, t.primary_border(t.dialog_border), edges)
}
- Surface::Panel | Surface::Chrome if !self.floating() => Self::compact_frame(fill, t.border, self.joined.unwrap_or(DockEdges::ALL)),
- Surface::Feature | Surface::Window => {
- flat.stroke(egui::Stroke::new(1.0, t.dialog_border)).corner_radius(t.radius_xl).shadow(t.shell_shadow())
+ Surface::Panel | Surface::Chrome if !self.floating() => {
+ Self::compact_frame(fill, t.primary_border(t.border), self.joined.unwrap_or(DockEdges::ALL))
}
- Surface::Palette => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_xl).shadow(t.shell_shadow()),
- Surface::Panel | Surface::Chrome => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_lg).shadow(t.shell_shadow()),
- Surface::Navigation => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_md),
- Surface::Toast => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_md).shadow(t.shell_shadow()),
+ Surface::Feature | Surface::Window => flat.stroke(t.primary_border(t.dialog_border)).corner_radius(t.radius_xl).shadow(t.shell_shadow()),
+ Surface::Palette => flat.stroke(t.primary_border(t.border)).corner_radius(t.radius_xl).shadow(t.shell_shadow()),
+ Surface::Panel | Surface::Chrome => flat.stroke(t.primary_border(t.border)).corner_radius(t.radius_lg).shadow(t.shell_shadow()),
+ Surface::Navigation => flat.stroke(t.primary_border(t.border)).corner_radius(t.radius_md),
+ Surface::Toast => flat.stroke(t.primary_border(t.border)).corner_radius(t.radius_md).shadow(t.shell_shadow()),
Surface::Popup => Self::popup_frame(&ctx.global_style()).fill(fill),
Surface::ApplicationBar | Surface::Canvas | Surface::Viewport | Surface::InputShield => flat,
}
@@ -123,7 +123,7 @@ impl Container {
/// supplied by `frame`; edge-hosted panes must not acquire outer shadows or card gaps.
pub fn edge_frame(self, fill: Color32) -> Frame {
if self.adaptive() && !self.floating() {
- Self::compact_frame(fill, Tokens::get().border, self.joined.unwrap_or(DockEdges::ALL))
+ Self::compact_frame(fill, Tokens::get().primary_border(Tokens::get().border), self.joined.unwrap_or(DockEdges::ALL))
} else {
Frame::NONE.fill(fill)
}
@@ -143,14 +143,14 @@ impl Container {
}
}
- fn compact_frame(fill: Color32, border: Color32, edges: DockEdges) -> Frame {
- // Collapse adjoining borders onto the same one-point strip. North/west outlines
+ fn compact_frame(fill: Color32, border: Stroke, edges: DockEdges) -> Frame {
+ // Collapse adjoining borders onto the same themed-width strip. North/west outlines
// sit outside the allocation; south/east outlines sit inside it. Logical panel
// rectangles still touch exactly, with neither gaps nor doubled strokes.
Frame::NONE
.fill(fill)
- .stroke(Stroke::new(1.0, border))
- .outer_margin(egui::Margin { left: -1, top: -1, right: 0, bottom: 0 })
+ .stroke(border)
+ .outer_margin(egui::Margin { left: -(border.width.ceil() as i8), top: -(border.width.ceil() as i8), right: 0, bottom: 0 })
.corner_radius(Self::compact_rounding(edges))
}
@@ -174,7 +174,52 @@ impl Container {
edges.bottom |= rect.bottom() >= bounds.bottom();
prepared.frame.corner_radius = Self::compact_rounding(edges);
}
- egui::InnerResponse { inner, response: prepared.end(ui) }
+ let frame = prepared.frame;
+ let response = prepared.end(ui);
+ Self::paint_inset(ui.painter(), response.rect - frame.outer_margin, frame);
+ egui::InnerResponse { inner, response }
+ }
+
+ /// Optional companion to a primary outline, painted inside the allocated surface.
+ /// It consumes no layout space or input target. Tiny/collapsed surfaces omit it.
+ pub(crate) fn paint_inset(painter: &egui::Painter, widget: egui::Rect, frame: Frame) {
+ let t = Tokens::get();
+ if let Some(bevel) = t.borders.bevel {
+ let mut chrome = painter.clone();
+ chrome.set_clip_rect(widget.intersect(painter.ctx().content_rect()));
+ bevel.paint(&chrome, widget, frame.corner_radius, false, true);
+ }
+ let Some(inset) = t.borders.primary_inset else {
+ return;
+ };
+ let distance = frame.stroke.width + inset.gap;
+ let rect = widget.shrink(distance);
+ if inset.stroke.width <= 0.0 || !rect.is_finite() || rect.width() <= 2.0 * inset.stroke.width || rect.height() <= 2.0 * inset.stroke.width {
+ return;
+ }
+ let reduce = |r: u8| r.saturating_sub(distance.ceil() as u8);
+ let radius = frame.corner_radius;
+ // A host's content clip excludes its padding. The companion belongs to the whole
+ // host, so clip to that known surface and the viewport instead of the content well.
+ let mut painter = painter.clone();
+ painter.set_clip_rect(widget.intersect(painter.ctx().content_rect()));
+ painter.rect_stroke(
+ rect,
+ egui::CornerRadius { nw: reduce(radius.nw), ne: reduce(radius.ne), sw: reduce(radius.sw), se: reduce(radius.se) },
+ inset.stroke,
+ egui::StrokeKind::Inside,
+ );
+ }
+
+ /// Manually painted chrome uses exactly the same outer and inset policy as hosts.
+ pub(crate) fn paint_frame(painter: &egui::Painter, frame: Frame, content: egui::Rect) {
+ painter.add(frame.paint(content));
+ Self::paint_inset(painter, frame.widget_rect(content), frame);
+ }
+
+ /// Decorate the content-hugging frame of a popup or feature sheet after its contents.
+ pub(crate) fn finish_content(ui: &egui::Ui, frame: Frame) {
+ Self::paint_inset(ui.painter(), frame.widget_rect(ui.min_rect()), frame);
}
pub fn area(self, id: Id) -> egui::Area {
@@ -198,14 +243,16 @@ impl Container {
/// Anchored editors inherit their containing widget's local style. Their host stays a
/// popup in both layouts; only the universal module constructs the egui popup frame.
pub fn popup_frame(style: &egui::Style) -> Frame {
- Frame::popup(style)
+ let mut frame = Frame::popup(style);
+ frame.stroke = Tokens::get().borders.stroke(crate::theme::BorderRole::Primary, frame.stroke);
+ frame
}
pub(crate) fn menu_frame() -> Frame {
let t = Tokens::get();
egui::Frame::NONE
.fill(t.dialog_body)
- .stroke(Stroke::new(1.0, t.dialog_border))
+ .stroke(t.primary_border(t.dialog_border))
.corner_radius(t.radius_xl)
.inner_margin(egui::Margin::symmetric(t.space_6 as i8, t.space_6 as i8))
.shadow(egui::Shadow {
@@ -231,7 +278,7 @@ impl Container {
pub(crate) fn tooltip_frame(self, ctx: &Context) -> Frame {
let t = Tokens::get();
self.frame(ctx, t.dialog_body, crate::frame::Side::Right)
- .stroke(egui::Stroke::new(1.0, t.dialog_border))
+ .stroke(t.primary_border(t.dialog_border))
.inner_margin(egui::Margin::symmetric(t.space_8 as i8, t.space_4 as i8))
}
diff --git a/crates/ui-egui/src/ui_kit/disclosure_tests.rs b/crates/ui-egui/src/ui_kit/disclosure_tests.rs
index e08a14ed7d..be81716b6b 100644
--- a/crates/ui-egui/src/ui_kit/disclosure_tests.rs
+++ b/crates/ui-egui/src/ui_kit/disclosure_tests.rs
@@ -16,9 +16,12 @@ fn assert_glyph(
// at the control's position without the former vertical flip.
let id = if open { "chevron" } else { "chevron_right" };
let master = icon_svg::resolve(id).master;
- let image =
- icon_svg::render(icon_svg::doc_for(master, px).unwrap(), icon_svg::Look { dark: true, accent: None, vision: crate::theme::vision() }, px)
- .unwrap();
+ let image = icon_svg::render(
+ icon_svg::doc_for(master, px).unwrap(),
+ icon_svg::Look { dark: true, accent: None, vision: crate::theme::vision(), palette: None },
+ px,
+ )
+ .unwrap();
let mut expected = ColorImage::from_rgba_premultiplied([px as usize, px as usize], image.data());
for pixel in &mut expected.pixels {
*pixel = t.form_dim.gamma_multiply(f32::from(pixel.a()) / 255.0);
diff --git a/crates/ui-egui/src/ui_kit/fields.rs b/crates/ui-egui/src/ui_kit/fields.rs
index 3132fc17ff..9df88cf2b5 100644
--- a/crates/ui-egui/src/ui_kit/fields.rs
+++ b/crates/ui-egui/src/ui_kit/fields.rs
@@ -61,7 +61,7 @@ pub(crate) fn multiline_text_field(ui: &mut Ui, label: &str, id: egui::Id, value
.id(id)
.desired_rows(3)
.font(egui::FontId::monospace(t.font_label))
- .background_color(t.control_fill),
+ .background_color(t.input_fill()),
);
publish(ui, &response, egui::WidgetType::TextEdit);
response
@@ -146,9 +146,10 @@ fn editor(ui: &mut Ui, value: &mut String, hint: &str, completion: bool) -> (boo
let font = egui::FontId::monospace(t.font_label);
let response = ui.add_sized(
vec2(width, row_height()),
- text_input(egui::TextEdit::singleline(value)).hint_text(hint).font(font).background_color(t.control_fill).clip_text(true),
+ text_input(egui::TextEdit::singleline(value)).hint_text(hint).font(font).background_color(t.input_fill()).clip_text(true),
);
crate::theme::TabAccent::number_focus(ui, &response);
+ t.input_bevel(ui, &response);
let label = crate::i18n::tr_label(label(ui));
response.widget_info(|| {
let mut info = egui::WidgetInfo::labeled(egui::WidgetType::TextEdit, ui.is_enabled(), label);
@@ -209,7 +210,7 @@ pub(crate) fn selection_field(ui: &mut Ui, text: &str, options: Selection) -> Re
if active && !filled { rect.shrink(t.space_2) } else { rect },
t.control_radius,
if filled { t.selected_bg } else { t.control_fill },
- egui::Stroke::new(1.0, if active || filled { t.form_primary } else { t.control_border }),
+ if active || filled { egui::Stroke::new(1.0, t.form_primary) } else { t.control_border_stroke(t.control_border) },
egui::StrokeKind::Inside,
);
let end = if filled { t.space_24 } else { t.space_8 };
@@ -274,7 +275,7 @@ fn cell_editor_frame(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str,
.id(id)
.hint_text(crate::i18n::tr_label(hint))
.font(if frame { egui::FontId::monospace(t.font_label) } else { egui::FontId::proportional(t.font_label) })
- .background_color(if invalid { t.form_error_fill } else { t.control_fill })
+ .background_color(if invalid { t.form_error_fill } else { t.input_fill() })
.text_color(if invalid { t.form_error } else { t.form_ink })
.clip_text(true);
let editor = if invalid {
@@ -291,13 +292,18 @@ fn cell_editor_frame(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str,
editor.frame(egui::Frame::NONE.inner_margin(egui::Margin::symmetric(t.space_8 as i8, 0)))
};
let response = ui.add_sized(vec2(dimension(ui.available_width()), row_height()), editor);
- publish(ui, &response, egui::WidgetType::TextEdit);
+ if frame {
+ publish(ui, &response, egui::WidgetType::TextEdit);
+ } else {
+ super::layout::publish_geometry(ui, &response);
+ }
response.widget_info(|| {
let mut info = egui::WidgetInfo::labeled(egui::WidgetType::TextEdit, ui.is_enabled(), crate::i18n::tr_label(label(ui)));
info.current_text_value = Some(value.clone());
info
});
crate::theme::TabAccent::number_focus(ui, &response);
+ t.input_bevel(ui, &response);
response
}
@@ -383,6 +389,7 @@ pub(crate) fn scalar_field(ui: &mut Ui, value: &mut f64, range: std::ops::RangeI
vec2(dimension(ui.available_width()), row_height()),
egui::DragValue::new(value).range(range).speed(0.01).custom_parser(crate::prefs::parse_number),
);
+ Tokens::get().input_bevel(ui, &response);
scenario::publish_target(&format!("dialog:scalar:{}", label(ui)), response.rect);
response
}
@@ -391,6 +398,7 @@ pub(crate) fn scalar_field(ui: &mut Ui, value: &mut f64, range: std::ops::RangeI
/// Tokens: control_height, scope control/font tokens.
pub(crate) fn length_field(ui: &mut Ui, value: &mut f64, units: &str, decimals: u8) -> Response {
let response = ui.add(length_drag(value, units, decimals));
+ Tokens::get().input_bevel(ui, &response);
scenario::publish_target(&format!("dialog:length:{}", label(ui)), response.rect);
response
}
@@ -398,6 +406,7 @@ pub(crate) fn length_field(ui: &mut Ui, value: &mut f64, units: &str, decimals:
/// Angle in degrees, dragged or typed. Tokens: control_height, scope control/font tokens.
pub(crate) fn angle_field(ui: &mut Ui, value: &mut f64) -> Response {
let response = ui.add(egui::DragValue::new(value).speed(1.0).suffix(" deg").custom_parser(crate::prefs::parse_number));
+ Tokens::get().input_bevel(ui, &response);
scenario::publish_target(&format!("dialog:angle:{}", label(ui)), response.rect);
response
}
@@ -413,8 +422,9 @@ pub(crate) fn text_area(ui: &mut Ui, label: &str, id: egui::Id, value: &mut Stri
.desired_rows(rows.clamp(1, 16))
.char_limit(limit)
.font(egui::FontId::monospace(t.font_label))
- .background_color(t.control_fill),
+ .background_color(t.input_fill()),
);
+ t.input_bevel(ui, &response);
response.widget_info(|| {
let mut info = egui::WidgetInfo::labeled(egui::WidgetType::TextEdit, ui.is_enabled(), label);
info.current_text_value = Some(value.clone());
@@ -434,7 +444,7 @@ pub(crate) fn password_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint
.password(true)
.hint_text(hint)
.font(egui::FontId::monospace(t.font_label))
- .background_color(t.control_fill),
+ .background_color(t.input_fill()),
);
publish(ui, &response, egui::WidgetType::TextEdit);
response
@@ -450,6 +460,7 @@ pub(crate) fn number_field<T: egui::emath::Numeric>(
suffix: &str,
) -> Response {
let response = ui.add(egui::DragValue::new(value).range(range).speed(speed).suffix(suffix).custom_parser(crate::prefs::parse_number));
+ Tokens::get().input_bevel(ui, &response);
response.widget_info(|| {
let mut info = egui::WidgetInfo::drag_value(ui.is_enabled(), value.to_f64());
info.label = Some(crate::i18n::tr_label(label(ui)).to_string());
@@ -464,15 +475,17 @@ pub(crate) fn number_field<T: egui::emath::Numeric>(
#[cfg(any(not(target_arch = "wasm32"), test))]
pub(crate) fn message_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
let t = Tokens::get();
- ui.add(
+ let response = ui.add(
text_input(egui::TextEdit::multiline(value))
.id(id)
.hint_text(hint)
.desired_rows(2)
.desired_width(f32::INFINITY)
.font(egui::FontId::proportional(t.font_label))
- .background_color(t.control_fill),
- )
+ .background_color(t.input_fill()),
+ );
+ t.input_bevel(ui, &response);
+ response
}
/// Edit a millimetre value through a control expressed in the current design units.
@@ -492,11 +505,13 @@ fn length_drag<'a>(value: &'a mut f64, units: &str, decimals: u8) -> egui::DragV
/// keyboard to the next widget.
pub(crate) fn canvas_value_field(ui: &mut Ui, id: egui::Id, value: &mut String, keep_tab: bool) -> Response {
let t = Tokens::get();
- let mut edit = egui::TextEdit::singleline(value).id(id).desired_width(t.space_24 * 3.0);
+ let mut edit = egui::TextEdit::singleline(value).id(id).desired_width(t.space_24 * 3.0).background_color(t.input_fill());
if keep_tab {
edit = edit.event_filter(egui::EventFilter { tab: true, horizontal_arrows: true, ..Default::default() });
}
- ui.add(edit)
+ let response = ui.add(edit);
+ t.input_bevel(ui, &response);
+ response
}
/// Placement editor whose owner routes Enter and Tab (including rejected expressions).
@@ -515,7 +530,7 @@ pub(crate) fn placement_field(ui: &mut Ui, id: egui::Id, value: &mut String, hin
.return_key(None)
.event_filter(egui::EventFilter { tab: true, horizontal_arrows: true, vertical_arrows: true, ..Default::default() })
.font(font)
- .background_color(t.control_fill)
+ .background_color(t.input_fill())
.text_color(t.form_ink)
.clip_text(true),
);
@@ -526,6 +541,7 @@ pub(crate) fn placement_field(ui: &mut Ui, id: egui::Id, value: &mut String, hin
info
});
crate::theme::TabAccent::number_focus(ui, &response);
+ t.input_bevel(ui, &response);
response.on_hover_text(crate::i18n::tr_label(hint))
}
@@ -534,7 +550,7 @@ pub(crate) fn placement_field(ui: &mut Ui, id: egui::Id, value: &mut String, hin
pub(crate) fn library_cell(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str, menu: impl FnOnce(&mut Ui)) -> Response {
let t = Tokens::get();
let (rect, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), row_height()), egui::Sense::hover());
- ui.painter().rect(rect, t.control_radius, t.control_fill, egui::Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
+ ui.painter().rect(rect, t.control_radius, t.control_fill, t.control_border_stroke(t.control_border), egui::StrokeKind::Inside);
let split = (rect.right() - t.space_24).max(rect.left());
let field = egui::Rect::from_min_max(rect.min, egui::pos2(split, rect.bottom()));
let response = ui
@@ -544,7 +560,7 @@ pub(crate) fn library_cell(ui: &mut Ui, id: egui::Id, value: &mut String, hint:
})
.inner;
let button = egui::Rect::from_min_max(egui::pos2(split, rect.top()), rect.max);
- ui.painter().vline(split, rect.y_range(), egui::Stroke::new(1.0, t.dialog_rule));
+ t.secondary_vline(ui.painter(), split, rect.y_range(), t.dialog_rule);
let library = super::icon_button_at(ui, button, "chevron", "Library");
scenario::publish_handle("dialog:menu:Library", button.center());
scenario::publish_rect("dialog:menu:Library", button);
diff --git a/crates/ui-egui/src/ui_kit/file_view.rs b/crates/ui-egui/src/ui_kit/file_view.rs
index fe72260064..d9e34b3e81 100644
--- a/crates/ui-egui/src/ui_kit/file_view.rs
+++ b/crates/ui-egui/src/ui_kit/file_view.rs
@@ -96,7 +96,7 @@ impl FileView {
pub(crate) fn recent_list<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {
let t = Tokens::get();
- egui::Frame::NONE.fill(t.file_surface).stroke(Stroke::new(1.0, t.file_border)).corner_radius(t.radius_xl).show(ui, |ui| {
+ egui::Frame::NONE.fill(t.file_surface).stroke(t.tertiary_border(t.file_border)).corner_radius(t.radius_xl).show(ui, |ui| {
ui.spacing_mut().item_spacing.y = 0.0;
let key = ui.id().with("file_recent_index");
ui.ctx().data_mut(|data| data.insert_temp(key, 0_usize));
@@ -221,10 +221,11 @@ impl FileView {
let t = Tokens::get();
ui.add_space(t.space_10);
let (rect, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), 1.0), Sense::hover());
- ui.painter().hline(
+ t.secondary_hline(
+ ui.painter(),
(rect.left() + t.space_12)..=(rect.right() - t.space_12).max(rect.left() + t.space_12),
rect.center().y,
- Stroke::new(1.0, t.file_rail_ink.gamma_multiply(0.25)),
+ t.file_rail_ink.gamma_multiply(0.25),
);
ui.add_space(t.space_10);
}
@@ -265,7 +266,7 @@ impl FileView {
});
if let Some((key, index)) = list {
if index > 0 {
- ui.painter().hline(rect.x_range(), rect.top(), Stroke::new(1.0, t.file_border));
+ ui.painter().hline(rect.x_range(), rect.top(), t.tertiary_border(t.file_border));
}
ui.ctx().data_mut(|data| data.insert_temp(key, index.saturating_add(1)));
}
@@ -400,12 +401,18 @@ fn card(ui: &Ui, rect: Rect, response: &Response, primary: bool) {
t.file_surface
};
let border = if primary || response.has_focus() { t.file_primary_border } else { t.file_border };
- ui.painter().rect(rect, t.radius_xl, fill, Stroke::new(if primary { 1.5 } else { 1.0 }, border), egui::StrokeKind::Inside);
+ ui.painter().rect(
+ rect,
+ t.radius_xl,
+ fill,
+ if primary || response.has_focus() { Stroke::new(if primary { 1.5 } else { 1.0 }, border) } else { t.tertiary_border(border) },
+ egui::StrokeKind::Inside,
+ );
}
fn thumbnail(ui: &Ui, rect: Rect, texture: Option<(TextureId, Vec2)>) {
let t = Tokens::get();
- ui.painter().rect(rect, t.radius_md, t.file_surface, Stroke::new(1.0, t.file_border), egui::StrokeKind::Inside);
+ ui.painter().rect(rect, t.radius_md, t.file_surface, t.tertiary_border(t.file_border), egui::StrokeKind::Inside);
if let Some((texture, size)) = texture.filter(|(_, size)| size.is_finite() && size.x > 0.0 && size.y > 0.0) {
let scale = (rect.width() / size.x).min(rect.height() / size.y);
let target = Align2::CENTER_CENTER.align_size_within_rect(size * scale, rect);
@@ -426,7 +433,7 @@ fn recovery_panel(
let border = if banner { t.file_recovery_border } else { t.file_border };
egui::Frame::NONE
.fill(fill)
- .stroke(Stroke::new(1.0, border))
+ .stroke(if banner { Stroke::new(1.0, border) } else { t.tertiary_border(border) })
.corner_radius(t.radius_xl)
.inner_margin(egui::Margin::symmetric(t.space_16 as i8, t.space_12 as i8))
.show(ui, |ui| {
diff --git a/crates/ui-egui/src/ui_kit/gallery.rs b/crates/ui-egui/src/ui_kit/gallery.rs
index 3c4573896d..634c55abef 100644
--- a/crates/ui-egui/src/ui_kit/gallery.rs
+++ b/crates/ui-egui/src/ui_kit/gallery.rs
@@ -1724,7 +1724,7 @@ fn confirm_radial_and_history_rows_keep_multitone_artwork() {
assert!(colours.len() >= 2, "{surface}/{icon}/{kind}/{tab}, dark={dark}: opaque artwork is a silhouette");
let resolved = crate::icon_svg::resolve(icon);
assert!(!resolved.placeholder, "{icon} needs a master");
- let look = crate::icon_svg::Look { dark, accent: ramp.and_then(crate::icon_svg::accent_index), vision: crate::theme::vision() };
+ let look = crate::icon_svg::Look::themed(dark, ramp.and_then(crate::icon_svg::accent_index), crate::theme::vision());
let doc = crate::icon_svg::doc_for(resolved.master, side as u32).unwrap();
let expected = if matches!(surface, "danger" | "danger_menu") {
crate::icon_svg::render_tinted(doc, look, side as u32)
diff --git a/crates/ui-egui/src/ui_kit/history.rs b/crates/ui-egui/src/ui_kit/history.rs
index bae10ccbb6..a74b9872f4 100644
--- a/crates/ui-egui/src/ui_kit/history.rs
+++ b/crates/ui-egui/src/ui_kit/history.rs
@@ -85,7 +85,13 @@ impl HistoryChip<'_> {
let radius = if style == HistoryStyle::Icons { t.radius_lg } else { t.radius_sm };
if style != HistoryStyle::Names || self.error {
let weight = if style == HistoryStyle::Icons && (self.selected || self.error) { 1.5 } else { 1.0 };
- p.rect(rect, radius, fill, Stroke::new(weight, edge), egui::StrokeKind::Inside);
+ p.rect(
+ rect,
+ radius,
+ fill,
+ if self.error || self.selected || self.hovered { Stroke::new(weight, edge) } else { t.tertiary_border(edge) },
+ egui::StrokeKind::Inside,
+ );
} else {
p.rect_filled(rect, radius, fill);
}
diff --git a/crates/ui-egui/src/ui_kit/layout.rs b/crates/ui-egui/src/ui_kit/layout.rs
index aa1c32f3b7..e610bb918e 100644
--- a/crates/ui-egui/src/ui_kit/layout.rs
+++ b/crates/ui-egui/src/ui_kit/layout.rs
@@ -29,11 +29,11 @@ pub(crate) fn scope<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R {
visuals.weak_text_color = Some(t.form_dim);
visuals.selection.stroke = egui::Stroke::new(1.0, t.form_primary);
visuals.selection.bg_fill = t.selected_bg;
- visuals.widgets.noninteractive.bg_stroke = egui::Stroke::new(1.0, t.dialog_rule);
+ visuals.widgets.noninteractive.bg_stroke = t.tertiary_border(t.dialog_rule);
for state in [&mut visuals.widgets.inactive, &mut visuals.widgets.hovered, &mut visuals.widgets.active, &mut visuals.widgets.open] {
state.bg_fill = t.control_fill;
state.weak_bg_fill = t.control_fill;
- state.bg_stroke = egui::Stroke::new(1.0, t.control_border);
+ state.bg_stroke = t.control_border_stroke(t.control_border);
state.corner_radius = t.control_radius.into();
state.expansion = 0.0;
state.fg_stroke.color = t.form_ink;
@@ -51,6 +51,12 @@ pub(crate) fn label(ui: &Ui) -> &str {
/// Publish accessibility and scenario geometry. Tokens: `none`.
pub(super) fn publish(ui: &Ui, response: &Response, kind: egui::WidgetType) {
+ let t = Tokens::get();
+ match kind {
+ egui::WidgetType::TextEdit => t.input_bevel(ui, response),
+ egui::WidgetType::ComboBox | egui::WidgetType::Button => t.button_bevel(ui, response, false),
+ _ => {}
+ }
let label = label(ui);
response.widget_info(|| egui::WidgetInfo::labeled(kind, ui.is_enabled(), crate::i18n::tr_label(label)));
publish_geometry(ui, response);
@@ -190,7 +196,7 @@ pub(crate) fn section_count<R>(
rule_left = badge.right() + t.space_12;
}
if rule_left < rect.right() {
- ui.painter().hline(rule_left..=rect.right(), rect.center().y, egui::Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), rule_left..=rect.right(), rect.center().y, t.dialog_rule);
}
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::CollapsingHeader, ui.is_enabled(), open, crate::i18n::tr_label(title)));
scenario::publish_handle(&format!("dialog:section:{title}"), response.rect.center());
@@ -221,7 +227,7 @@ pub(crate) fn list_row(ui: &mut Ui, key: &str, text: &str) -> Response {
/// Full-width rule without extra padding. Tokens: `dialog_rule`.
pub(crate) fn divider(ui: &mut Ui, key: &str) {
let (rect, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), 1.0), egui::Sense::hover());
- ui.painter().hline(rect.x_range(), rect.top(), egui::Stroke::new(1.0, Tokens::get().dialog_rule));
+ Tokens::get().secondary_hline(ui.painter(), rect.x_range(), rect.top(), Tokens::get().dialog_rule);
scenario::publish_rect(&format!("dialog:divider:{key}"), rect);
}
@@ -342,7 +348,7 @@ pub(crate) fn text(ui: &mut Ui, text: &str, style: Text<'_>) -> Response {
pub(crate) fn summary_row(ui: &mut Ui, name: &str, summary: &str, enabled: &mut bool, actions_width: f32, actions: impl FnOnce(&mut Ui)) -> bool {
let t = Tokens::get();
let (rect, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), row_height() + t.space_16), egui::Sense::hover());
- ui.painter().rect(rect, t.radius_lg, t.dialog_body, egui::Stroke::new(1.0, t.dialog_rule), egui::StrokeKind::Inside);
+ t.container_rect(ui.painter(), rect, t.radius_lg, t.dialog_body, t.dialog_rule);
let check = egui::Rect::from_min_size(rect.min + vec2(t.space_6, 0.0), vec2(t.space_24, rect.height()));
let changed = ui
.scope_builder(egui::UiBuilder::new().max_rect(check).layout(egui::Layout::left_to_right(egui::Align::Center)), |ui| {
diff --git a/crates/ui-egui/src/ui_kit/menu.rs b/crates/ui-egui/src/ui_kit/menu.rs
index cd49e87d09..431c68a758 100644
--- a/crates/ui-egui/src/ui_kit/menu.rs
+++ b/crates/ui-egui/src/ui_kit/menu.rs
@@ -38,7 +38,9 @@ impl Menu {
ui.spacing_mut().item_spacing.y = 0.0;
// The opening gesture belongs to the parent even when a narrow popup overlaps it.
ui.ctx().data_mut(|d| d.insert_temp(gate_id, first_click && !released));
- ui.add_enabled_ui(!opening_press, add).inner
+ let result = ui.add_enabled_ui(!opening_press, add).inner;
+ Container::finish_content(ui, frame);
+ result
};
let popup = if nested {
let submenu = Container::new(ui.ctx(), Surface::Popup).submenu();
@@ -60,20 +62,24 @@ impl Menu {
super::Container::menu_frame()
}
+ pub(crate) fn show_frame<R>(ui: &mut Ui, frame: egui::Frame, add: impl FnOnce(&mut Ui) -> R) -> egui::InnerResponse<R> {
+ let bounds = ui.max_rect();
+ Container::new(ui.ctx(), Surface::Popup).show_frame(ui, frame, bounds, add)
+ }
+
pub(crate) fn show<R>(ui: &mut Ui, width: f32, add: impl FnOnce(&mut Ui) -> R) -> R {
- Self::frame()
- .show(ui, |ui| {
- ui.set_width((width - Tokens::get().space_6 * 2.0 - 2.0).max(0.0));
- ui.spacing_mut().item_spacing.y = 0.0;
- ui.with_layout(egui::Layout::top_down(egui::Align::Min), add).inner
- })
- .inner
+ Self::show_frame(ui, Self::frame(), |ui| {
+ ui.set_width((width - Tokens::get().space_6 * 2.0 - 2.0).max(0.0));
+ ui.spacing_mut().item_spacing.y = 0.0;
+ ui.with_layout(egui::Layout::top_down(egui::Align::Min), add).inner
+ })
+ .inner
}
pub(crate) fn separator(ui: &mut Ui) {
let t = Tokens::get();
let (r, _) = ui.allocate_exact_size(vec2(ui.available_width(), t.space_10 + 1.0), Sense::hover());
- ui.painter().hline(r.x_range(), r.center().y, Stroke::new(1.0, t.dialog_rule));
+ ui.painter().hline(r.x_range(), r.center().y, t.tertiary_border(t.dialog_rule));
}
pub(crate) fn heading(ui: &mut Ui, label: &str) {
@@ -187,7 +193,7 @@ impl<'a> MenuItem<'a> {
super::checks::paint_check_glyph(&painter, icon, false, t.form_primary);
}
} else if let Some(color) = self.swatch {
- painter.rect(icon, t.radius_sm, color, Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
+ painter.rect(icon, t.radius_sm, color, t.control_border_stroke(t.control_border), egui::StrokeKind::Inside);
} else if !self.icon.is_empty() {
if self.danger {
icons::paint_danger(&painter, icon, self.icon, 1.0);
@@ -230,7 +236,7 @@ pub(crate) fn workspace_menu(ui: &mut egui::Ui, items: &[Item], key_row: Option<
let t = Tokens::get();
let width = t.form_card_width + t.form_label_width * 2.0 + t.space_24 + t.space_16 + t.space_6;
let mut picked = None;
- Menu::frame().inner_margin(t.space_8 + 1.0).show(ui, |ui| {
+ Menu::show_frame(ui, Menu::frame().inner_margin(t.space_8 + 1.0), |ui| {
ui.set_width(width);
ui.spacing_mut().item_spacing.y = 0.0;
ui.add_space(t.space_4);
@@ -268,18 +274,18 @@ pub(crate) fn workspace_menu(ui: &mut egui::Ui, items: &[Item], key_row: Option<
crate::scenario::publish_target(&handle, r);
}
if current || (item.enabled && (resp.hovered() || key_row == Some(k))) {
- ui.painter().rect_filled(r, 5.0, soft);
+ ui.painter().rect_filled(r, t.control_radius.saturating_sub(1), soft);
}
ui.painter().rect_filled(
Rect::from_min_max(r.min + vec2(t.space_2, t.space_6 + 1.0), pos2(r.left() + 6.0, r.bottom() - 7.0)),
- 2.0,
+ t.radius_sm / 2,
accent,
);
let tile = Rect::from_center_size(
pos2(r.left() + 40.0, r.center().y),
vec2(t.space_24 + t.space_16 + t.space_4, t.space_24 + t.space_16 + t.space_4),
);
- ui.painter().rect_filled(tile, 9.0, if planned { t.panel_header } else { soft });
+ ui.painter().rect_filled(tile, t.radius_xl.saturating_sub(1), if planned { t.panel_header } else { soft });
if !item.icon.is_empty() {
icons::paint_icon(ui.painter(), tile.shrink(t.space_6 + 1.0), &item.icon, if item.enabled { 1.0 } else { 0.35 });
}
@@ -307,7 +313,7 @@ pub(crate) fn workspace_menu(ui: &mut egui::Ui, items: &[Item], key_row: Option<
if current { t.on_accent } else { accent },
);
let badge_rect = Rect::from_min_size(pos2(badge_x, y - 8.0), badge.size() + vec2(t.space_12, t.space_3));
- ui.painter().rect_filled(badge_rect, 8.0, if current { accent } else { soft });
+ ui.painter().rect_filled(badge_rect, t.radius_lg, if current { accent } else { soft });
ui.painter().galley(badge_rect.min + vec2(t.space_6, t.space_3 / 2.0), badge, accent);
let line = |content: String, y: f32| {
let mut job =
@@ -353,6 +359,7 @@ pub(crate) fn rename_menu(ui: &mut Ui, value: &mut String, focused: &mut bool) -
Menu::heading(ui, "Rename");
let id = egui::Id::new("sc_rename_text");
let response = ui.add(super::fields::text_input(egui::TextEdit::singleline(value).id(id)).desired_width(ui.available_width()));
+ t.input_bevel(ui, &response);
crate::scenario::publish_target("rename:name", response.rect);
if !*focused {
if let Some(mut state) = egui::TextEdit::load_state(ui.ctx(), id) {
diff --git a/crates/ui-egui/src/ui_kit/panel.rs b/crates/ui-egui/src/ui_kit/panel.rs
index f8f20e8dae..4d7e4d43f3 100644
--- a/crates/ui-egui/src/ui_kit/panel.rs
+++ b/crates/ui-egui/src/ui_kit/panel.rs
@@ -59,7 +59,7 @@ fn header_impl(ui: &mut Ui, icon: &str, title: &str, collapsed: Option<&mut bool
let title_response = ui.interact(title_rect, ui.make_persistent_id("title_text"), egui::Sense::hover());
title_response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), title));
scenario::publish_rect("dialog:header", rect);
- ui.painter().hline(rect.x_range(), rect.bottom(), egui::Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), rect.x_range(), rect.bottom(), t.dialog_rule);
}
/// A bounded docked or floating card. Uses form_card_width and the caller's tokenised frame.
@@ -312,6 +312,7 @@ impl<'a> Panel<'a> {
ui.interact(rect, ui.id().with("compute_status"), egui::Sense::hover()).on_hover_text(status);
ui.ctx().request_repaint_after(std::time::Duration::from_millis(100));
}
+ super::Container::finish_content(ui, self.positioned_frame(ui.ctx()));
(close, action)
})
}
@@ -360,6 +361,7 @@ impl<'a> Panel<'a> {
} else {
contents(ui);
}
+ super::Container::finish_content(ui, self.positioned_frame(ui.ctx()));
});
}
}
@@ -560,7 +562,9 @@ impl<'a> Window<'a> {
.frame(frame)
.show(ctx, |ui| {
ui.set_width(inner_width);
- add(ui)
+ let result = add(ui);
+ super::Container::finish_content(ui, frame);
+ result
});
scenario::publish_rect("dialog:window", shown.response.rect);
return shown.inner;
@@ -583,7 +587,11 @@ impl<'a> Window<'a> {
(None, Some((pivot, pos))) => window.pivot(pivot).default_pos(pos),
(None, None) => window.pivot(egui::Align2::CENTER_CENTER).default_pos(ctx.content_rect().center() - vec2(0.0, row_height() * 2.5)),
};
- let shown = window.show(ctx, add);
+ let shown = window.show(ctx, |ui| {
+ let result = add(ui);
+ super::Container::finish_content(ui, frame);
+ result
+ });
if let Some(shown) = &shown {
scenario::publish_rect("dialog:window", shown.response.rect);
}
@@ -614,7 +622,7 @@ fn page_list_sized<S>(ui: &mut Ui, selected: &mut usize, pages: &[WindowPage<S>]
let width = (t.form_label_width * 2.0 + t.space_24 * 2.0).min(body.width());
let nav = egui::Rect::from_min_size(body.min, vec2(width, body.height()));
ui.painter().rect_filled(nav, 0.0, t.dialog_footer);
- ui.painter().vline(nav.right(), nav.y_range(), egui::Stroke::new(1.0, t.dialog_rule));
+ t.secondary_vline(ui.painter(), nav.right(), nav.y_range(), t.dialog_rule);
scenario::publish_rect("dialog:pages", nav);
*selected = (*selected).min(pages.len().saturating_sub(1));
ui.scope_builder(egui::UiBuilder::new().max_rect(nav.shrink2(vec2(t.space_8, t.space_6))), |ui| {
diff --git a/crates/ui-egui/src/ui_kit/panel_tests.rs b/crates/ui-egui/src/ui_kit/panel_tests.rs
index ae596624ac..36e974f174 100644
--- a/crates/ui-egui/src/ui_kit/panel_tests.rs
+++ b/crates/ui-egui/src/ui_kit/panel_tests.rs
@@ -716,3 +716,230 @@ fn compact_tool_sheet_corners_follow_its_right_edge_contact() {
assert_eq!(container.tool_frame(frame, false).corner_radius, egui::CornerRadius::same(t.radius_lg));
assert_eq!(container.tool_frame(frame, true).corner_radius, egui::CornerRadius { nw: t.radius_lg, ne: 0, sw: t.radius_lg, se: 0 });
}
+
+#[test]
+fn theme_shape_changes_preserve_panel_geometry_and_dock_contacts() {
+ use crate::{frame::Side, shell::LayoutMode};
+ let ctx = crate::fonts::test_context();
+ let mut results = Vec::new();
+ for name in ["solidcraft-95", "blueprint", "cupertino"] {
+ let t = crate::theme_files::resolve(crate::theme_files::find(name, &[]).unwrap());
+ let _theme = crate::theme::scoped_tokens(t);
+ for surface in [Surface::Panel, Surface::Feature, Surface::Window, Surface::Popup, Surface::Navigation, Surface::Toast] {
+ crate::theme::apply(&ctx);
+ let floating = Container::for_layout(LayoutMode::Floating, surface).frame(&ctx, t.panel, Side::Left);
+ let bounds = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(240.0, 180.0));
+ results.push((name, surface, floating.corner_radius, floating.outer_rect(bounds), t));
+ }
+ let docked = Container::for_layout(LayoutMode::Docked, Surface::Panel)
+ .joined(DockEdges { left: true, top: true, ..Default::default() })
+ .frame(&ctx, t.panel, Side::Left);
+ assert_eq!(docked.corner_radius, egui::CornerRadius { nw: 0, ne: 0, sw: 0, se: t.radius_lg });
+ }
+ for (name, surface, radius, bounds, t) in &results {
+ let expected = match surface {
+ Surface::Panel => t.radius_lg,
+ Surface::Feature | Surface::Window => t.radius_xl,
+ _ => t.radius_md,
+ };
+ assert_eq!(*radius, egui::CornerRadius::same(expected), "{name}: {surface:?}");
+ assert_eq!(*bounds, results.iter().find(|row| row.1 == *surface).unwrap().3, "shape must not change layout");
+ }
+}
+
+#[test]
+fn border_hierarchy_reaches_hosts_sections_controls_and_inset_without_new_targets() {
+ use crate::theme::{Borders, InsetBorder};
+ use egui::{Color32, Stroke};
+ for dark in [false, true] {
+ let mut t = if dark { Tokens::dark() } else { Tokens::light() };
+ t.borders = Borders {
+ primary: Some(Stroke::new(4.0, Color32::WHITE)),
+ secondary: Some(Stroke::new(2.0, Color32::RED)),
+ secondary_dotted: false,
+ tertiary: Some(Stroke::new(0.5, Color32::GREEN)),
+ container: None,
+ bevel: None,
+ control: Some(Stroke::new(1.5, Color32::BLUE)),
+ primary_inset: Some(InsetBorder { stroke: Stroke::new(0.75, Color32::YELLOW), gap: 3.0 }),
+ };
+ let _restore = crate::theme::scoped_tokens(t);
+ let ctx = crate::fonts::test_context();
+ let mut value = "12 mm".to_string();
+ let output = crate::test_support::frame(&ctx, egui::RawInput::default(), |ui| {
+ let container = Container::for_layout(crate::shell::LayoutMode::Floating, Surface::Panel);
+ let frame = container.frame(ui.ctx(), t.panel, crate::frame::Side::Left).inner_margin(12);
+ let bounds = ui.max_rect();
+ container.show_frame(ui, frame, bounds, |ui| {
+ ui.set_width(280.0);
+ scope(ui, |ui| {
+ header(ui, "box", "Box", || {});
+ row(ui, "Width", |ui| {
+ field(ui, &mut value);
+ });
+ ui.separator();
+ });
+ });
+ });
+ let mut found = [false; 5];
+ for shape in &output.shapes {
+ crate::test_support::each_shape(&shape.shape, &mut |shape| {
+ let stroke = match shape {
+ egui::Shape::Rect(rect) => Some(rect.stroke),
+ egui::Shape::LineSegment { stroke, .. } => Some(*stroke),
+ _ => None,
+ };
+ if let Some(stroke) = stroke {
+ for (index, expected) in [
+ t.borders.primary.unwrap(),
+ t.borders.secondary.unwrap(),
+ t.borders.tertiary.unwrap(),
+ t.borders.control.unwrap(),
+ t.borders.primary_inset.unwrap().stroke,
+ ]
+ .iter()
+ .enumerate()
+ {
+ found[index] |= stroke == *expected;
+ }
+ }
+ });
+ }
+ assert!(found.into_iter().all(|v| v), "missing role: {found:?}");
+ for layout in [crate::shell::LayoutMode::Floating, crate::shell::LayoutMode::Docked] {
+ for surface in [
+ Surface::Panel,
+ Surface::Chrome,
+ Surface::Feature,
+ Surface::Palette,
+ Surface::Window,
+ Surface::Popup,
+ Surface::Toast,
+ Surface::Navigation,
+ ] {
+ let frame = Container::for_layout(layout, surface).frame(&ctx, t.panel, crate::frame::Side::Left);
+ assert_eq!(frame.stroke, t.borders.primary.unwrap(), "{layout:?} {surface:?}");
+ assert!(frame.total_margin().sum().is_finite());
+ }
+ }
+ }
+}
+
+#[test]
+fn inset_border_skips_tiny_or_invalid_surfaces_and_keeps_dock_contacts_square() {
+ let mut t = Tokens::dark();
+ t.borders.primary = Some(egui::Stroke::new(4.0, egui::Color32::WHITE));
+ t.borders.primary_inset = Some(crate::theme::InsetBorder { stroke: egui::Stroke::new(4.0, egui::Color32::YELLOW), gap: 12.0 });
+ let _restore = crate::theme::scoped_tokens(t);
+ let ctx = crate::fonts::test_context();
+ let output = crate::test_support::frame(&ctx, egui::RawInput::default(), |ui| {
+ let frame = Container::for_layout(crate::shell::LayoutMode::Docked, Surface::Panel).joined(DockEdges::ALL).frame(
+ &ctx,
+ t.panel,
+ crate::frame::Side::Left,
+ );
+ assert_eq!(frame.corner_radius, egui::CornerRadius::ZERO);
+ assert_eq!(frame.outer_margin.left, -4);
+ for rect in [egui::Rect::from_min_size(egui::pos2(20.0, 20.0), egui::vec2(20.0, 20.0)), egui::Rect::NOTHING] {
+ Container::paint_inset(ui.painter(), rect, frame);
+ }
+ });
+ for shape in &output.shapes {
+ crate::test_support::each_shape(&shape.shape, &mut |s| {
+ if let egui::Shape::Rect(rect) = s {
+ assert_ne!(rect.stroke.color, egui::Color32::YELLOW);
+ }
+ });
+ }
+}
+
+#[test]
+fn menu_companion_is_visible_in_frame_padding_and_bounded_by_its_surface() {
+ let mut t = Tokens::dark();
+ t.borders.primary = Some(egui::Stroke::new(2.0, egui::Color32::WHITE));
+ t.borders.primary_inset = Some(crate::theme::InsetBorder { stroke: egui::Stroke::new(0.75, egui::Color32::YELLOW), gap: 3.0 });
+ let _restore = crate::theme::scoped_tokens(t);
+ let ctx = crate::fonts::test_context();
+ let mut surface = egui::Rect::NOTHING;
+ let output = crate::test_support::frame(&ctx, egui::RawInput::default(), |ui| {
+ surface = Menu::show_frame(ui, Menu::frame(), |ui| {
+ ui.set_width(200.0);
+ ui.label("New Design");
+ Menu::separator(ui);
+ ui.label("Open");
+ })
+ .response
+ .rect;
+ });
+ let mut found = false;
+ for clipped in &output.shapes {
+ crate::test_support::each_shape(&clipped.shape, &mut |shape| {
+ if let egui::Shape::Rect(rect) = shape
+ && rect.stroke.color == egui::Color32::YELLOW
+ {
+ found = true;
+ assert!(surface.contains_rect(rect.rect));
+ assert!(clipped.clip_rect.contains_rect(rect.rect));
+ assert!((rect.rect.left() - surface.left() - 5.0).abs() < 0.01);
+ }
+ });
+ }
+ assert!(found, "the companion must be painted outside the menu content clip");
+}
+
+#[test]
+fn bevel_lighting_reverses_for_fields_and_pressed_buttons_without_changing_geometry() {
+ use egui::{Color32, Pos2, Rect};
+ let mut t = Tokens::light();
+ let bevel =
+ crate::theme::Bevel { width: 1.0, highlight: Color32::WHITE, light: Color32::LIGHT_GRAY, shadow: Color32::GRAY, dark_shadow: Color32::BLACK };
+ t.borders.bevel = Some(bevel);
+ t.control_radius = 0;
+ let _restore = crate::theme::scoped_tokens(t);
+ let ctx = crate::fonts::test_context();
+ let mut button_rect = Rect::NOTHING;
+ let mut field_rect = Rect::NOTHING;
+ let mut text = "12 mm".to_string();
+ let mut draw = |ui: &mut Ui| {
+ ui.set_width(240.0);
+ scope(ui, |ui| {
+ button_rect = button(ui, "Review", Button::Normal).rect;
+ field_rect = cell_editor(ui, egui::Id::new("bevel-field"), &mut text, "", false).rect;
+ });
+ };
+ fn top_color(output: &egui::FullOutput, rect: Rect, inset: f32) -> Color32 {
+ output
+ .shapes
+ .iter()
+ .find_map(|shape| match &shape.shape {
+ egui::Shape::LineSegment { points: [a, b], stroke }
+ if (a.y - rect.top() - inset).abs() < 0.01 && (b.y - a.y).abs() < 0.01 && a.x >= rect.left() && b.x <= rect.right() =>
+ {
+ Some(stroke.color)
+ }
+ _ => None,
+ })
+ .expect("horizontal bevel edge")
+ }
+ let raised = crate::test_support::frame(&ctx, egui::RawInput::default(), &mut draw);
+ assert_eq!(top_color(&raised, button_rect, 0.5), bevel.highlight);
+ assert_eq!(top_color(&raised, field_rect, 1.5), bevel.shadow);
+ let original_rect = button_rect;
+ let mut draw = |ui: &mut Ui| {
+ ui.set_width(240.0);
+ scope(ui, |ui| {
+ button_rect = button(ui, "Review", Button::Normal).rect;
+ cell_editor(ui, egui::Id::new("bevel-field"), &mut text, "", false);
+ });
+ };
+ let down = crate::test_support::frame(
+ &ctx,
+ egui::RawInput { events: crate::test_support::pointer(original_rect.center(), true), ..Default::default() },
+ &mut draw,
+ );
+ assert_eq!(button_rect, original_rect);
+ assert_eq!(top_color(&down, button_rect, 0.5), bevel.shadow);
+ let tiny = Rect::from_min_size(Pos2::ZERO, egui::vec2(2.0, 2.0));
+ let output = crate::test_support::frame(&ctx, egui::RawInput::default(), |ui| bevel.paint(ui.painter(), tiny, 0, false, true));
+ assert!(!output.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::LineSegment { .. })));
+}
diff --git a/crates/ui-egui/src/ui_kit/preferences.rs b/crates/ui-egui/src/ui_kit/preferences.rs
index a3f920d72c..3237f5c27b 100644
--- a/crates/ui-egui/src/ui_kit/preferences.rs
+++ b/crates/ui-egui/src/ui_kit/preferences.rs
@@ -67,10 +67,11 @@ pub(crate) struct ThemeSwatch {
panel: Color32,
accent: Color32,
dim: Color32,
+ radius: u8,
}
impl From<Tokens> for ThemeSwatch {
fn from(t: Tokens) -> Self {
- Self { background: t.viewport_top, panel: t.panel, accent: t.accent, dim: t.text_dim }
+ Self { background: t.viewport_top, panel: t.panel, accent: t.accent, dim: t.text_dim, radius: t.control_radius }
}
}
@@ -223,7 +224,7 @@ pub(crate) fn option_card(ui: &mut Ui, label: &str, note: Option<&str>, selected
} else {
t.control_fill
},
- Stroke::new(if selected { 2.0 } else { 1.0 }, if selected { t.form_primary } else { t.control_border }),
+ if selected { Stroke::new(2.0, t.form_primary) } else { t.control_border_stroke(t.control_border) },
egui::StrokeKind::Inside,
);
let mut preview = Rect::from_min_size(rect.min + vec2(t.space_6, t.space_6), vec2((rect.width() - t.space_12).max(0.0), preview_height));
@@ -295,7 +296,7 @@ fn paint_preference_figure(p: &egui::Painter, rect: Rect, figure: PreferenceFigu
return;
}
p.rect_filled(rect, t.control_radius, t.viewport_top);
- p.rect_stroke(rect, t.control_radius, Stroke::new(1.0, t.dialog_rule), egui::StrokeKind::Inside);
+ t.container_rect(&p, rect, t.control_radius, egui::Color32::TRANSPARENT, t.dialog_rule);
match figure {
PreferenceFigure::Theme { .. } => {}
PreferenceFigure::Quality(sides) => {
@@ -308,7 +309,7 @@ fn paint_preference_figure(p: &egui::Painter, rect: Rect, figure: PreferenceFigu
centre + vec2(a.cos(), a.sin()) * radius
})
.collect();
- p.extend(egui::Shape::dashed_line(&guide, Stroke::new(1.0, t.control_border), t.space_2, t.space_3));
+ p.extend(egui::Shape::dashed_line(&guide, t.control_border_stroke(t.control_border), t.space_2, t.space_3));
let points = (0..n)
.map(|i| {
let a = std::f32::consts::TAU * i as f32 / n as f32;
@@ -384,7 +385,7 @@ fn clip_half_plane(vertices: Vec<Pos2>, side: impl Fn(Pos2) -> f32) -> Vec<Pos2>
}
fn theme_swatch(p: &egui::Painter, r: Rect, c: ThemeSwatch, diagonal: bool) {
- let boundary = rounded_perimeter(r, f32::from(Tokens::get().control_radius));
+ let boundary = rounded_perimeter(r, f32::from(c.radius));
let fill = |mut vertices: Vec<Pos2>, color: Color32| {
if diagonal {
vertices = clip_half_plane(vertices, |v| (v.x - r.left()) / r.width() + (v.y - r.top()) / r.height() - 1.0);
@@ -453,7 +454,7 @@ pub(crate) fn scale_specimen(ui: &mut Ui, scale: f32) {
let t = Tokens::get();
let scale = if scale.is_finite() { scale.clamp(0.5, 2.5) / ui.ctx().zoom_factor().max(0.5) } else { 1.0 };
let (r, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), t.space_24 * 4.0 + t.space_16), Sense::hover());
- ui.painter().rect(r, t.radius_lg, t.control_fill, Stroke::new(1.0, t.dialog_rule), egui::StrokeKind::Inside);
+ t.container_rect(ui.painter(), r, t.radius_lg, t.control_fill, t.dialog_rule);
let p = ui.painter().with_clip_rect(r.shrink(t.space_8));
let font = FontId::proportional(t.font_label * scale);
p.text(
@@ -469,11 +470,23 @@ pub(crate) fn scale_specimen(ui: &mut Ui, scale: f32) {
let label = p.layout_no_wrap(distance.to_owned(), font.clone(), t.form_dim);
p.galley(origin + vec2(0.0, (line_h - label.size().y) / 2.0), label.clone(), t.form_dim);
let field = Rect::from_min_size(origin + vec2(label.size().x + t.space_8 * scale, 0.0), vec2((t.form_label_width + t.space_6) * scale, line_h));
- p.rect(field, t.control_radius, t.control_fill, Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
+ p.rect(field, t.control_radius, t.input_fill(), t.control_border_stroke(t.control_border), egui::StrokeKind::Inside);
+ if let Some(bevel) = t.borders.bevel {
+ bevel.paint(&p, field, t.control_radius, true, true);
+ }
centred_text(&p, field, "12.50", FontId::monospace(t.font_body * scale), t.form_ink);
let button = Rect::from_min_size(field.right_top() + vec2(t.space_8 * scale, 0.0), vec2(t.space_24 * 1.5 * scale, line_h));
- p.rect_filled(button, t.control_radius, t.form_primary);
- centred_text(&p, button, crate::i18n::tr_label("OK"), crate::fonts::semibold(t.font_label * scale), t.on_accent);
+ p.rect_filled(button, t.control_radius, if t.borders.bevel.is_some() { t.control_fill } else { t.form_primary });
+ if let Some(bevel) = t.borders.bevel {
+ bevel.paint(&p, button, t.control_radius, false, true);
+ }
+ centred_text(
+ &p,
+ button,
+ crate::i18n::tr_label("OK"),
+ crate::fonts::semibold(t.font_label * scale),
+ if t.borders.bevel.is_some() { t.form_ink } else { t.on_accent },
+ );
let feature = Rect::from_min_size(origin + vec2(0.0, line_h + t.space_8 * scale), vec2(r.width() - t.space_10 * 2.0, line_h));
p.rect_filled(feature, t.control_radius, t.selected_bg);
let icon = Rect::from_center_size(pos2(feature.left() + t.space_16 * scale, feature.center().y), vec2(t.space_16, t.space_16) * scale);
@@ -485,7 +498,7 @@ pub(crate) fn scale_specimen(ui: &mut Ui, scale: f32) {
crate::fonts::semibold(t.font_label * scale),
t.selected_ink,
);
- p.text(feature.right_center() - vec2(t.space_8, 0.0), egui::Align2::RIGHT_CENTER, "12.5 mm", font, t.form_dim);
+ p.text(feature.right_center() - vec2(t.space_8, 0.0), egui::Align2::RIGHT_CENTER, "12.5 mm", font, t.selected_ink);
}
/// Font picker and auxiliary actions share one line, with the specimen below.
@@ -515,7 +528,7 @@ pub(crate) fn settings_inline_note(ui: &mut Ui, text: &str) {
pub(crate) fn font_specimen(ui: &mut Ui, text: &str) {
let t = Tokens::get();
let (r, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), t.control_height + t.space_10), Sense::hover());
- ui.painter().rect(r, t.control_radius, t.control_fill, Stroke::new(1.0, t.dialog_rule), egui::StrokeKind::Inside);
+ t.container_rect(ui.painter(), r, t.control_radius, t.control_fill, t.dialog_rule);
paint_text(ui, r.shrink2(vec2(t.space_12, 0.0)), text, FontId::proportional(t.font_button), t.form_ink, false);
}
diff --git a/crates/ui-egui/src/ui_kit/preferences_assistant.rs b/crates/ui-egui/src/ui_kit/preferences_assistant.rs
index ed9e1de36d..6e559b45bc 100644
--- a/crates/ui-egui/src/ui_kit/preferences_assistant.rs
+++ b/crates/ui-egui/src/ui_kit/preferences_assistant.rs
@@ -44,11 +44,16 @@ fn choice_card(ui: &mut Ui, width: f32, choice: &SettingsChoice<'_>, selected: b
} else {
t.control_fill
},
- Stroke::new(if selected { 2.0 } else { 1.0 }, if selected { t.form_primary } else { t.control_border }),
+ if selected { Stroke::new(2.0, t.form_primary) } else { t.control_border_stroke(t.control_border) },
egui::StrokeKind::Inside,
);
let radio = pos2(rect.left() + t.space_16, rect.top() + t.space_16);
- ui.painter().circle(radio, t.space_6, t.control_fill, Stroke::new(1.0, if selected { t.form_primary } else { t.control_border }));
+ ui.painter().circle(
+ radio,
+ t.space_6,
+ t.control_fill,
+ if selected { Stroke::new(1.0, t.form_primary) } else { t.control_border_stroke(t.control_border) },
+ );
if selected {
ui.painter().circle_filled(radio, t.space_3, t.form_primary);
}
diff --git a/crates/ui-egui/src/ui_kit/preferences_figures.rs b/crates/ui-egui/src/ui_kit/preferences_figures.rs
index 2c90f458f6..ef46340ee7 100644
--- a/crates/ui-egui/src/ui_kit/preferences_figures.rs
+++ b/crates/ui-egui/src/ui_kit/preferences_figures.rs
@@ -184,10 +184,10 @@ pub(crate) fn paint_layout(ui: &mut egui::Ui, state: super::preferences::LayoutP
let size = vec2(super::metrics::dimension(ui.available_width()), t.space_24 * 7.0 + t.space_6);
let (outer, _) = ui.allocate_exact_size(size, egui::Sense::hover());
let p = ui.painter().with_clip_rect(outer);
- p.rect(outer, t.radius_lg, t.control_fill, Stroke::new(1.0, t.dialog_rule), egui::StrokeKind::Inside);
+ t.container_rect(&p, outer, t.radius_lg, t.control_fill, t.dialog_rule);
let r = outer.shrink(t.space_8);
let c = Canvas { rect: r };
- p.rect(r, t.control_radius, t.viewport_top, Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
+ p.rect(r, t.control_radius, t.viewport_top, t.control_border_stroke(t.control_border), egui::StrokeKind::Inside);
let inset = if state.compact { 0.0 } else { 4.0 };
let gap = if state.compact { 0.0 } else { 3.0 };
let ribbon_height = if state.labels { 16.0 } else { 10.0 };
@@ -205,7 +205,7 @@ pub(crate) fn paint_layout(ui: &mut egui::Ui, state: super::preferences::LayoutP
};
let panel = |x: f32, y: f32, w: f32, h: f32, label: &str, fill: Color32| {
let rect = Rect::from_min_max(c.at(x, y), c.at(x + w, y + h));
- p.rect(rect, if state.compact { 0 } else { t.radius_sm }, fill, Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
+ p.rect(rect, if state.compact { 0 } else { t.radius_sm }, fill, t.control_border_stroke(t.control_border), egui::StrokeKind::Inside);
if !label.is_empty() {
let centre = if h > 20.0 { c.at(x + w * 0.5, y + 7.0) } else { rect.center() };
p.text(centre, egui::Align2::CENTER_CENTER, crate::i18n::tr_label(label), egui::FontId::proportional(t.font_small), t.form_dim);
diff --git a/crates/ui-egui/src/ui_kit/preferences_navigation.rs b/crates/ui-egui/src/ui_kit/preferences_navigation.rs
index c314002a64..819c487727 100644
--- a/crates/ui-egui/src/ui_kit/preferences_navigation.rs
+++ b/crates/ui-egui/src/ui_kit/preferences_navigation.rs
@@ -42,7 +42,7 @@ fn settings_gesture(ui: &mut Ui, keys: &[String], action: &str) {
let width = dimension(ui.available_width());
let (rect, response) = ui.allocate_exact_size(vec2(width, t.control_height + t.space_2), Sense::hover());
response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), format!("{}: {action}", keys.join(" + "))));
- ui.painter().hline(rect.x_range(), rect.bottom(), Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), rect.x_range(), rect.bottom(), t.dialog_rule);
let key_width = (t.form_label_width * 2.0 + t.space_24 + t.space_6).min(width * 0.57);
let key_rect = Rect::from_min_size(rect.min, vec2(key_width, rect.height()));
let p = ui.painter().with_clip_rect(key_rect);
@@ -58,7 +58,7 @@ fn settings_gesture(ui: &mut Ui, keys: &[String], action: &str) {
pos2(x + (galley.size().x + t.space_12) / 2.0, rect.center().y),
vec2(galley.size().x + t.space_12, t.space_24 - t.space_2),
);
- p.rect(cap, t.radius_sm, t.control_fill, Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
+ p.rect(cap, t.radius_sm, t.control_fill, t.container_border(t.control_border), egui::StrokeKind::Inside);
p.galley(pos2(cap.center().x - galley.size().x / 2.0, cap.center().y - galley.size().y / 2.0), galley, t.form_ink);
x = cap.right() + t.space_4;
}
@@ -107,7 +107,7 @@ pub(crate) fn settings_axis_row(
) {
let t = Tokens::get();
let (rect, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), t.control_height + t.space_4), Sense::hover());
- ui.painter().hline(rect.x_range(), rect.bottom(), Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), rect.x_range(), rect.bottom(), t.dialog_rule);
let [label_rect, live_rect, invert_rect, speed_rect, source_rect] = axis_columns(rect);
paint_text(ui, label_rect, name, FontId::proportional(t.font_label), t.form_ink, false);
ui.interact(label_rect, ui.id().with("axis_name"), Sense::hover()).on_hover_text(name);
@@ -145,7 +145,7 @@ pub(crate) fn live_axis_bar_in(ui: &Ui, live_rect: Rect, value: f32, dead_zone:
);
let mut x = zone.left() - zone.height();
while x < zone.right() {
- p.with_clip_rect(zone).line_segment([pos2(x, zone.bottom()), pos2(x + zone.height(), zone.top())], Stroke::new(1.0, t.control_border));
+ p.with_clip_rect(zone).line_segment([pos2(x, zone.bottom()), pos2(x + zone.height(), zone.top())], t.control_border_stroke(t.control_border));
x += t.space_4;
}
let value = if value.is_finite() { value.clamp(-1.0, 1.0) } else { 0.0 };
diff --git a/crates/ui-egui/src/ui_kit/preferences_small.rs b/crates/ui-egui/src/ui_kit/preferences_small.rs
index 74d12d0611..d322d8d7a3 100644
--- a/crates/ui-egui/src/ui_kit/preferences_small.rs
+++ b/crates/ui-egui/src/ui_kit/preferences_small.rs
@@ -97,7 +97,7 @@ pub(crate) fn settings_bindings(ui: &mut Ui, bindings: &[(&[&str], &str)]) {
for (keys, action) in bindings {
let width = super::metrics::dimension(ui.available_width());
let (r, _) = ui.allocate_exact_size(vec2(width, t.control_height + t.space_2), Sense::hover());
- ui.painter().hline(r.x_range(), r.bottom(), Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), r.x_range(), r.bottom(), t.dialog_rule);
let mut left = r.left();
for key in *keys {
let galley = ui.painter().layout_no_wrap((*key).into(), FontId::proportional(t.font_small), t.form_ink);
@@ -105,7 +105,7 @@ pub(crate) fn settings_bindings(ui: &mut Ui, bindings: &[(&[&str], &str)]) {
pos2(left + (galley.size().x + t.space_12) * 0.5, r.center().y),
vec2(galley.size().x + t.space_12, t.control_height - t.space_8),
);
- ui.painter().rect(key_rect, t.radius_sm, t.control_fill, Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
+ ui.painter().rect(key_rect, t.radius_sm, t.control_fill, t.container_border(t.control_border), egui::StrokeKind::Inside);
ui.painter().galley(key_rect.center() - galley.size() * 0.5, galley, t.form_ink);
left = key_rect.right() + t.space_4;
}
diff --git a/crates/ui-egui/src/ui_kit/radial.rs b/crates/ui-egui/src/ui_kit/radial.rs
index 5ff653bb4e..884ebc8e38 100644
--- a/crates/ui-egui/src/ui_kit/radial.rs
+++ b/crates/ui-egui/src/ui_kit/radial.rs
@@ -6,7 +6,6 @@ use std::f32::consts::{FRAC_PI_2, FRAC_PI_4, PI, TAU};
pub(crate) const RADIAL_RADIUS: f32 = 150.0;
const INNER: f32 = 56.0;
const GAP: f32 = 4.0;
-const CORNER: f32 = 9.0;
const STEPS: usize = 16;
fn unit(a: f32) -> Vec2 {
@@ -14,14 +13,17 @@ fn unit(a: f32) -> Vec2 {
}
/// Two equally sampled boundaries; their ends are joined by parallel straight sides.
-/// The four joins are circular arcs of radius CORNER, tangent to both adjacent edges.
+/// The four joins are circular arcs of the theme radius, tangent to both adjacent edges.
fn boundaries(k: usize) -> (Vec<Pos2>, Vec<Pos2>) {
+ // The outer and inner circles are functional geometry; only the corner joins vary.
+ // Bound the radius so the inner arc remains ordered, even for hostile theme data.
+ let corner = f32::from(Tokens::get().radius_xl.saturating_sub(1)).min(12.0);
let am = -FRAC_PI_2 + (k % 8) as f32 * FRAC_PI_4;
let a0 = am - FRAC_PI_4 / 2.0;
let a1 = am + FRAC_PI_4 / 2.0;
- let d = GAP / 2.0 + CORNER;
- let ro = RADIAL_RADIUS - CORNER;
- let ri = INNER + CORNER;
+ let d = GAP / 2.0 + corner;
+ let ro = RADIAL_RADIUS - corner;
+ let ri = INNER + corner;
let outer0 = a0 + (d / ro).asin();
let outer1 = a1 - (d / ro).asin();
let inner0 = a0 + (d / ri).asin();
@@ -36,13 +38,13 @@ fn boundaries(k: usize) -> (Vec<Pos2>, Vec<Pos2>) {
}
};
let mut outer = Vec::new();
- arc(&mut outer, po0, CORNER, a0 - FRAC_PI_2, outer0);
+ arc(&mut outer, po0, corner, a0 - FRAC_PI_2, outer0);
arc(&mut outer, Pos2::ZERO, RADIAL_RADIUS, outer0, outer1);
- arc(&mut outer, po1, CORNER, outer1, a1 + FRAC_PI_2);
+ arc(&mut outer, po1, corner, outer1, a1 + FRAC_PI_2);
let mut inner = Vec::new();
- arc(&mut inner, pi0, CORNER, a0 - FRAC_PI_2, inner0 - PI);
+ arc(&mut inner, pi0, corner, a0 - FRAC_PI_2, inner0 - PI);
arc(&mut inner, Pos2::ZERO, INNER, inner0, inner1);
- arc(&mut inner, pi1, CORNER, inner1 - PI, a1 + FRAC_PI_2 - TAU);
+ arc(&mut inner, pi1, corner, inner1 - PI, a1 + FRAC_PI_2 - TAU);
(outer, inner)
}
@@ -192,4 +194,19 @@ mod tests {
}
}
}
+
+ #[test]
+ fn theme_corner_extremes_keep_radial_geometry_finite_and_clicks_in_their_sectors() {
+ for radius in [0, 1, 2, 16, 32] {
+ let _theme = crate::theme::scoped_tokens(Tokens { radius_xl: radius, ..Tokens::dark() });
+ for k in 0..8 {
+ let (outer, inner) = boundaries(k);
+ assert_eq!(outer.len(), inner.len());
+ assert!(outer.iter().chain(&inner).all(|p| p.is_finite()));
+ let a = -FRAC_PI_2 + k as f32 * FRAC_PI_4;
+ assert!(contains(k, unit(a) * 104.0));
+ assert!(!contains(k, unit(a + FRAC_PI_4 / 2.0) * 104.0));
+ }
+ }
+ }
}
diff --git a/crates/ui-egui/src/ui_kit/reports.rs b/crates/ui-egui/src/ui_kit/reports.rs
index e52f5f4e06..a67665b377 100644
--- a/crates/ui-egui/src/ui_kit/reports.rs
+++ b/crates/ui-egui/src/ui_kit/reports.rs
@@ -24,7 +24,7 @@ pub(crate) fn report_divider(ui: &mut Ui, key: &str) {
let (rect, _) = ui.allocate_exact_size(vec2(ui.available_width().max(0.0), 1.0), egui::Sense::hover());
let rect = rect.expand2(vec2(t.space_10, 0.0));
let clip = ui.clip_rect().expand2(vec2(t.space_10, 0.0));
- ui.painter().with_clip_rect(clip).hline(rect.x_range(), rect.top(), egui::Stroke::new(1.0, t.dialog_rule));
+ ui.painter().with_clip_rect(clip).hline(rect.x_range(), rect.top(), t.tertiary_border(t.dialog_rule));
scenario::publish_rect(&format!("dialog:divider:{key}"), rect);
}
@@ -32,7 +32,7 @@ pub(crate) fn report_divider(ui: &mut Ui, key: &str) {
pub(crate) fn list_frame<R>(ui: &mut Ui, key: &str, add: impl FnOnce(&mut Ui) -> R) -> R {
let t = Tokens::get();
let response = egui::Frame::NONE
- .stroke(egui::Stroke::new(1.0, t.dialog_rule))
+ .stroke(t.container_border(t.dialog_rule))
.corner_radius(t.control_radius)
.inner_margin(egui::Margin::symmetric(t.space_10 as i8, 0))
.show(ui, |ui| {
@@ -56,7 +56,7 @@ pub(crate) fn path_chip(ui: &mut Ui, path: &str, add: impl FnOnce(&mut Ui)) {
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
add(ui);
let (rect, response) = ui.allocate_exact_size(vec2(ui.available_width().max(0.0), t.control_height), egui::Sense::hover());
- ui.painter().rect(rect, t.control_radius, t.dialog_footer, egui::Stroke::new(1.0, t.dialog_rule), egui::StrokeKind::Inside);
+ ui.painter().rect(rect, t.control_radius, t.dialog_footer, t.tertiary_border(t.dialog_rule), egui::StrokeKind::Inside);
super::text::paint_text(ui, rect.shrink2(vec2(t.space_8, 0.0)), path, egui::FontId::monospace(t.font_small), t.form_dim, false);
response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), path));
response.on_hover_text(path);
@@ -76,7 +76,7 @@ pub(crate) fn empty_box(ui: &mut Ui, key: &str, message: &str) {
if let Some(first) = points.first().copied() {
points.push(first);
}
- ui.painter().extend(egui::Shape::dashed_line(&points, egui::Stroke::new(1.0, t.control_border), t.space_4, t.space_3));
+ ui.painter().extend(egui::Shape::dashed_line(&points, t.control_border_stroke(t.control_border), t.space_4, t.space_3));
ui.painter().text(rect.center(), egui::Align2::CENTER_CENTER, message, egui::FontId::proportional(t.font_label), t.form_dim);
scenario::publish_rect(&format!("dialog:note:{key}"), rect);
}
diff --git a/crates/ui-egui/src/ui_kit/search.rs b/crates/ui-egui/src/ui_kit/search.rs
index 4b821fda8c..0eea5586c8 100644
--- a/crates/ui-egui/src/ui_kit/search.rs
+++ b/crates/ui-egui/src/ui_kit/search.rs
@@ -97,9 +97,22 @@ impl CommandSearch {
t.control_border
};
if focused {
- ui.painter().rect_filled(r.expand(t.space_3), radius + t.space_3, if invalid { t.form_error_fill } else { t.accent_soft });
+ ui.painter().rect_filled(
+ r.expand(t.space_3),
+ Tokens::outset_radius(radius, t.space_3),
+ if invalid { t.form_error_fill } else { t.accent_soft },
+ );
+ }
+ ui.painter().rect(
+ r,
+ radius,
+ t.input_fill(),
+ if focused || invalid { Stroke::new(1.0, ink) } else { t.control_border_stroke(ink) },
+ egui::StrokeKind::Inside,
+ );
+ if let Some(bevel) = t.borders.bevel {
+ bevel.paint(ui.painter(), r.shrink(if focused || invalid { 1.0 } else { 0.0 }), radius, true, ui.is_enabled());
}
- ui.painter().rect(r, radius, t.control_fill, Stroke::new(1.0, ink), egui::StrokeKind::Inside);
icons::paint_icon(
ui.painter(),
Rect::from_center_size(r.left_center() + vec2((spacing.left + t.space_16 / 2.0).min(r.width() / 2.0), 0.0), vec2(t.space_16, t.space_16)),
@@ -152,7 +165,7 @@ impl CommandSearch {
let galley = ui.painter().layout_no_wrap(label.to_owned(), FontId::monospace(t.font_small), t.form_dim);
let size = galley.size() + vec2(padding, t.space_4);
let r = Rect::from_min_size(pos2(right.x - size.x, right.y - size.y / 2.0), size);
- ui.painter().rect(r, Self::inner_radius(), t.dialog_footer, Stroke::new(1.0, t.dialog_rule), egui::StrokeKind::Inside);
+ t.container_rect(ui.painter(), r, Self::inner_radius(), t.dialog_footer, t.dialog_rule);
ui.painter().galley(r.min + vec2(padding / 2.0, t.space_2), galley, t.form_dim);
size.x
}
@@ -163,12 +176,14 @@ impl CommandSearch {
pub(crate) fn detail(ui: &mut Ui, text: &str) {
let t = Tokens::get();
- egui::Frame::NONE.fill(t.control_fill).stroke(Stroke::new(1.0, t.dialog_rule)).corner_radius(t.control_radius).inner_margin(t.space_8).show(
- ui,
- |ui| {
+ egui::Frame::NONE
+ .fill(t.control_fill)
+ .stroke(t.container_border(t.dialog_rule))
+ .corner_radius(t.control_radius)
+ .inner_margin(t.space_8)
+ .show(ui, |ui| {
super::text(ui, text, super::Text::MonoNote("command_parameters"));
- },
- );
+ });
}
/// Lay out the full sheet, but allocate and paint only its unfolding height. The
@@ -204,6 +219,7 @@ impl CommandSearch {
// The edge-to-edge footer shares the card silhouette; keep the outer rule
// above its fill, as an overflow-clipped footer would in the board.
ui.painter().rect_stroke(sheet, t.radius_xl, frame.stroke, egui::StrokeKind::Inside);
+ super::Container::paint_inset(ui.painter(), sheet, frame);
ui.allocate_rect(sheet, Sense::hover());
crate::scenario::publish_target("ribbon:search_popup", sheet);
crate::scenario::publish_target("palette:outer", sheet);
@@ -222,7 +238,7 @@ impl CommandSearch {
let r = Rect::from_min_max(start, pos2(start.x + width, ui.min_rect().bottom()));
ui.painter()
.set(background, egui::Shape::rect_filled(r, egui::CornerRadius { nw: 0, ne: 0, sw: t.radius_xl, se: t.radius_xl }, t.dialog_footer));
- ui.painter().hline(r.x_range(), r.top(), Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), r.x_range(), r.top(), t.dialog_rule);
crate::scenario::publish_rect("ribbon:search_footer", r);
}
}
@@ -373,4 +389,30 @@ mod tests {
assert_eq!(CommandSearch::inner_radius(), 4);
assert_eq!(f32::from(CommandSearch::inner_radius()), f32::from(t.radius_xl) - t.space_6);
}
+
+ #[test]
+ fn square_theme_search_and_focus_ring_stay_square_through_expansion() {
+ let tokens = Tokens { radius_sm: 0, radius_md: 0, radius_lg: 0, radius_xl: 0, control_radius: 0, sketch_mode_radius: 0, ..Tokens::dark() };
+ let _theme = crate::theme::scoped_tokens(tokens);
+ let mut radii = Vec::new();
+ for floating in [false, true] {
+ for progress in [0.0, 0.5, 1.0] {
+ let radius = CommandSearch::field_radius(progress, floating);
+ let ctx = crate::fonts::test_context();
+ let mut query = String::new();
+ let output = ctx.run_ui(egui::RawInput::default(), |ui| {
+ CommandSearch::field(ui, &mut query, false, true, true, SearchFieldGeometry { height: 40.0, radius, progress }, 4096);
+ });
+ for shape in output.shapes {
+ if let egui::Shape::Rect(rect) = shape.shape
+ && (rect.fill == tokens.control_fill || rect.fill == tokens.accent_soft)
+ {
+ radii.push(rect.corner_radius);
+ }
+ }
+ }
+ }
+ assert_eq!(radii.len(), 12, "field and focus ring in both layouts at three expansion stages");
+ assert!(radii.iter().all(|radius| *radius == egui::CornerRadius::ZERO));
+ }
}
diff --git a/crates/ui-egui/src/ui_kit/shortcuts.rs b/crates/ui-egui/src/ui_kit/shortcuts.rs
index 7e2f98060b..88e324f675 100644
--- a/crates/ui-egui/src/ui_kit/shortcuts.rs
+++ b/crates/ui-egui/src/ui_kit/shortcuts.rs
@@ -67,7 +67,7 @@ fn search_with_icon(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -
r,
t.control_radius,
t.control_fill,
- Stroke::new(1.0, if focused { t.form_primary } else { t.control_border }),
+ if focused { Stroke::new(1.0, t.form_primary) } else { t.control_border_stroke(t.control_border) },
egui::StrokeKind::Inside,
);
let icon = Rect::from_center_size(pos2(r.left() + t.space_8 + t.space_16 * 0.5, r.center().y), vec2(t.space_16, t.space_16));
diff --git a/crates/ui-egui/src/ui_kit/status.rs b/crates/ui-egui/src/ui_kit/status.rs
index 1451fc85ee..b98851908e 100644
--- a/crates/ui-egui/src/ui_kit/status.rs
+++ b/crates/ui-egui/src/ui_kit/status.rs
@@ -1,6 +1,6 @@
//! Status heading and constraint meter; Tokens: font_label, text, text_dim, accent, dialog_rule, sketch_accent, spacing.
use crate::{fonts::RichTextExt as _, theme::Tokens};
-use egui::{RichText, Stroke, vec2};
+use egui::{RichText, vec2};
/// Status content for a named card. `key` is the scenario namespace, `fraction` is clamped.
pub(crate) struct StatusHeader<'a> {
@@ -40,7 +40,7 @@ pub(crate) fn status_header(ui: &mut egui::Ui, key: &str, name: &str, status: St
crate::scenario::publish_count(&format!("{key}:constrained_fraction"), f64::from(fraction));
})
.response;
- ui.painter().hline(ui.max_rect().x_range(), ui.cursor().top(), Stroke::new(1.0, t.dialog_rule));
+ t.secondary_hline(ui.painter(), ui.max_rect().x_range(), ui.cursor().top(), t.dialog_rule);
crate::scenario::publish_target(&format!("{key}:status_header"), response.rect);
response
}
diff --git a/crates/ui-egui/src/ui_kit/table.rs b/crates/ui-egui/src/ui_kit/table.rs
index 224d11efab..32ceb8f790 100644
--- a/crates/ui-egui/src/ui_kit/table.rs
+++ b/crates/ui-egui/src/ui_kit/table.rs
@@ -176,7 +176,7 @@ impl Table<'_> {
scenario::publish_rect(&format!("dialog:column:{}:{}", self.id, column.label), cell);
left = cell.right() + t.space_8;
}
- ui.painter().hline(rect.x_range(), rect.bottom(), egui::Stroke::new(1.0, t.dialog_rule));
+ ui.painter().hline(rect.x_range(), rect.bottom(), t.tertiary_border(t.dialog_rule));
ui.advance_cursor_after_rect(rect);
}
@@ -204,7 +204,7 @@ impl Table<'_> {
self.empty_shown = true;
}
let (rect, response) = ui.allocate_exact_size(vec2(self.width(), row_height() - t.space_4), egui::Sense::click());
- let stroke = egui::Stroke::new(1.0, t.control_border);
+ let stroke = t.control_border_stroke(t.control_border);
let mut outline = Vec::new();
egui::epaint::tessellator::path::rounded_rectangle(&mut outline, rect.shrink(stroke.width * 0.5), f32::from(t.control_radius).into());
if let Some(first) = outline.first().copied() {
@@ -372,7 +372,7 @@ pub(crate) fn active_pill(ui: &mut Ui) {
let label = crate::i18n::tr_label("Active");
let width = label_width(ui, label) + t.space_16;
let (rect, response) = ui.allocate_exact_size(vec2(width, t.font_small + t.space_6), egui::Sense::hover());
- ui.painter().rect(rect, t.radius_xl, t.control_fill, egui::Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
+ ui.painter().rect(rect, t.radius_xl, t.control_fill, t.control_border_stroke(t.control_border), egui::StrokeKind::Inside);
super::text::paint_text(ui, rect.shrink2(vec2(t.space_8, 0.0)), label, crate::fonts::semibold(t.font_small), t.form_primary, false);
response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), label));
scenario::publish_handle(&format!("dialog:inline:{label}"), rect.center());
diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs
index ca936436fb..a0b672fc11 100644
--- a/crates/ui-egui/src/viewport.rs
+++ b/crates/ui-egui/src/viewport.rs
@@ -345,6 +345,8 @@ fn scene_key(app: &SolveApp) -> u64 {
app.tree.redefine.hash(&mut h);
crate::theme::is_dark().hash(&mut h);
crate::theme::vision().hash(&mut h);
+ // Two themes may share a light/dark base while drawing different geometry colours.
+ crate::theme_files::color_key(&Tokens::get()).hash(&mut h);
app.session.active_sketch.hash(&mut h);
h.finish()
}
@@ -1926,7 +1928,7 @@ fn analysis_legend(app: &SolveApp, painter: &egui::Painter, rect: Rect) {
}
for (c, text, hatched) in rows {
let sw = Rect::from_min_size(pos2(r.left() + pad, y + 2.0), vec2(12.0, 12.0));
- painter.rect_filled(sw, 2.0, c);
+ painter.rect_filled(sw, t.radius_sm / 2, c);
if hatched {
// The stripes the viewport adds to these faces (colour vision modes).
for k in [3.0, 7.0, 11.0] {
@@ -2212,6 +2214,8 @@ fn highlight_geometry_key(app: &SolveApp) -> u64 {
(app.dialog.is_some(), app.tool.is_some()).hash(&mut h);
crate::theme::is_dark().hash(&mut h);
crate::theme::vision().hash(&mut h);
+ // Two themes may share a light/dark base while drawing different geometry colours.
+ crate::theme_files::color_key(&Tokens::get()).hash(&mut h);
app.preview.effective_replaced().hash(&mut h);
app.preview.rolled_back.hash(&mut h);
app.origin_visible().hash(&mut h);
@@ -3505,8 +3509,8 @@ fn agent_chip(app: &mut SolveApp, ui: &egui::Ui, rect: Rect) {
let galley = painter.layout_no_wrap(format!("{label} · {computing}"), FontId::proportional(t.font_label), t.text);
let stop = painter.layout_no_wrap(crate::i18n::tr("ui.agent_chat_stop").to_string(), FontId::proportional(t.font_label), t.text);
let r = Rect::from_min_size(pos, vec2(galley.size().x + stop.size().x + 54.0, galley.size().y.max(stop.size().y) + 8.0));
- painter.rect_filled(r, 4.0, t.overlay);
- painter.rect_stroke(r, 4.0, Stroke::new(1.0, crate::icons::pointer::agent()), egui::StrokeKind::Inside);
+ painter.rect_filled(r, t.radius_sm, t.overlay);
+ painter.rect_stroke(r, t.radius_sm, Stroke::new(1.0, crate::icons::pointer::agent()), egui::StrokeKind::Inside);
egui::Spinner::new()
.color(crate::icons::pointer::agent())
.size(t.space_12)
@@ -3514,7 +3518,7 @@ fn agent_chip(app: &mut SolveApp, ui: &egui::Ui, rect: Rect) {
painter.galley(pos + vec2(26.0, 4.0), galley.clone(), t.text);
let button = Rect::from_min_size(pos2(pos.x + galley.size().x + 34.0, r.top() + 2.0), vec2(stop.size().x + 12.0, r.height() - 4.0));
let clicked = ui.interact(button, egui::Id::new("sc_agent_stop"), Sense::click());
- painter.rect_filled(button, 3.0, if clicked.hovered() { t.hover } else { t.overlay });
+ painter.rect_filled(button, t.radius_sm.saturating_sub(1), if clicked.hovered() { t.hover } else { t.overlay });
painter.galley(button.min + vec2(6.0, 2.0), stop, t.text);
crate::scenario::publish_handle("agent:stop", button.center());
if clicked.clicked() {
@@ -3593,7 +3597,7 @@ fn paint_toast(ui: &egui::Ui, free: Rect, text: String, error: bool, computing:
return None;
}
let frame = Container::new(ui.ctx(), Surface::Toast).frame(ui.ctx(), t.panel, crate::frame::Side::Left);
- ui.painter().add(frame.paint(r.shrink(frame.stroke.width)));
+ Container::paint_frame(ui.painter(), frame, r.shrink(frame.stroke.width));
let dot = pos2(r.left() + 14.0, r.center().y);
if computing {
egui::Spinner::new().size(12.0).color(t.text).paint_at(ui, Rect::from_center_size(dot, vec2(12.0, 12.0)));
@@ -4369,7 +4373,7 @@ fn nav_bar(app: &mut SolveApp, ui: &mut egui::Ui, rect: Rect) {
let mut painter = ui.painter_at(rect);
painter.set_opacity(if active || app.preferences.navigator_style == crate::prefs::NavigatorStyle::Axes { 1.0 } else { 0.45 });
let surface = Container::new(ui.ctx(), Surface::Navigation).frame(ui.ctx(), t.overlay, crate::frame::Side::Left);
- painter.add(surface.paint(bar.shrink(surface.stroke.width)));
+ Container::paint_frame(&painter, surface, bar.shrink(surface.stroke.width));
let columns = ((bar.width() - 10.0) / 30.0).round().clamp(1.0, 10.0) as usize;
for (i, (icon, tip)) in items.iter().enumerate() {
let br = Rect::from_min_size(
diff --git a/crates/ui-egui/src/viewport_appearance_tests.rs b/crates/ui-egui/src/viewport_appearance_tests.rs
index 05d88d33c4..a898f82156 100644
--- a/crates/ui-egui/src/viewport_appearance_tests.rs
+++ b/crates/ui-egui/src/viewport_appearance_tests.rs
@@ -54,3 +54,78 @@ fn placed_step_body_uses_imported_opacity_until_a_design_look_overrides_it() {
assert!(remainder.is_empty());
assert!(vertices.iter().all(|v| v[27] == 102));
}
+
+/// Exercise the live GPU scene slots: a fresh headless render always rebuilds and would hide
+/// stale cached geometry. Theme changes must update bytes while retaining the model's mesh.
+#[test]
+fn theme_switches_refresh_cached_viewport_colours_without_remeshing() {
+ let mut h = crate::scenario::Harness::new();
+ h.app.home.open = false;
+ h.app.ui.ground_shadow = false;
+ h.app.ui.show_origin = false;
+ h.app.run("solid.box", json!({"length": 20, "width": 15, "height": 10})).unwrap();
+ h.app.viewport.gpu = Some(super::GpuTarget { format: egui_wgpu::wgpu::TextureFormat::Rgba8Unorm, depth: None, samples: 1, tess: false });
+ let body = h.app.session.world_state().bodies[0].name.clone();
+ h.app.session.selection = vec![solidcraft_engine::Sel::Body { name: body.clone() }];
+ h.frame();
+ let revision = h.app.session.revision;
+ let mesh = h.app.session.world_state().bodies[0].cached_mesh().unwrap();
+ let mut previous: Option<(u64, u64, u64)> = None;
+ for theme in ["dark", "gruvbox-dark", "blueprint", "dark", "light", "solidcraft-95", "cupertino", "light"] {
+ let result = h.call("ui.prefs", json!({"theme": theme}));
+ assert!(result.get("error").is_none(), "{result}");
+ h.frame();
+ let keys = (h.app.viewport.key, h.app.viewport.sketch_key, h.app.viewport.hl_key);
+ if let Some(old) = previous {
+ assert_ne!(keys.0, old.0, "{theme}: model cache");
+ assert_ne!(keys.1, old.1, "{theme}: sketch cache");
+ assert_ne!(keys.2, old.2, "{theme}: highlight cache");
+ }
+ previous = Some(keys);
+ let scene = h.app.viewport.slot.lock().unwrap().take().expect("new model colours uploaded").merged();
+ let (vertices, remainder) = scene.tris.as_chunks::<{ crate::gpu::TRI_SIZE }>();
+ assert!(remainder.is_empty() && !vertices.is_empty());
+ let colour = super::c4(crate::theme::Tokens::get().body);
+ assert!(vertices.iter().all(|v| v[24..28] == colour), "{theme}: stale body colour");
+ assert_eq!(h.app.session.revision, revision, "theme changes must not edit the design");
+ assert!(std::sync::Arc::ptr_eq(&mesh, &h.app.session.world_state().bodies[0].cached_mesh().unwrap()));
+ h.frame();
+ assert_eq!((h.app.viewport.key, h.app.viewport.sketch_key, h.app.viewport.hl_key), keys);
+ assert!(h.app.viewport.slot.lock().unwrap().is_none(), "an unchanged theme reuses its scene");
+ }
+ h.app.run("appearance.assign", json!({"bodies": [body], "color": "#336699"})).unwrap();
+ for theme in ["gruvbox-dark", "blueprint", "solidcraft-95"] {
+ h.call("ui.prefs", json!({"theme": theme}));
+ h.frame();
+ let scene = h.app.viewport.slot.lock().unwrap().take().unwrap().merged();
+ let (vertices, _) = scene.tris.as_chunks::<{ crate::gpu::TRI_SIZE }>();
+ assert!(!vertices.is_empty());
+ assert!(vertices.iter().all(|v| v[24..28] == [51, 102, 153, 255]), "{theme}: explicit appearance preserved");
+ }
+}
+
+#[test]
+fn cancelling_theme_preview_restores_viewport_palette_keys() {
+ let mut h = crate::scenario::Harness::new();
+ h.app.home.open = false;
+ h.call("ui.prefs", json!({"theme": "gruvbox-dark"}));
+ h.frame();
+ let keys = |app: &SolveApp| (super::scene_key(app), super::highlight_geometry_key(app));
+ let before = keys(&h.app);
+ h.call("ui.prefs", json!({"open": "Interface"}));
+ h.call("ui.prefs", json!({"theme": "blueprint"}));
+ h.frame();
+ assert_ne!(keys(&h.app), before);
+ h.call("ui.prefs", json!({"button": "cancel"}));
+ h.frame();
+ assert_eq!(keys(&h.app), before);
+ // Replacing an imported palette keeps its id and base but still changes geometry colours.
+ let custom = |color| json!({"format":"solidcraft-theme/1","name":"Viewport test","base":"dark","colors":{"body":color}});
+ h.call("ui.prefs", json!({"theme_import": custom("#abcdef")}));
+ h.call("ui.prefs", json!({"theme": "viewport-test"}));
+ h.frame();
+ let first = keys(&h.app);
+ h.call("ui.prefs", json!({"theme_import": custom("#fedcba")}));
+ h.frame();
+ assert_ne!(keys(&h.app), first);
+}
diff --git a/crates/ui-egui/tests/icon_audit.rs b/crates/ui-egui/tests/icon_audit.rs
index 30b4d669e6..b47b29406f 100644
--- a/crates/ui-egui/tests/icon_audit.rs
+++ b/crates/ui-egui/tests/icon_audit.rs
@@ -483,7 +483,7 @@ fn offset_mode_artwork_review() {
);
let mut x = column as i32 * 200 + 8;
for px in [64, 24, 16] {
- let look = icon_svg::Look { dark, accent: resolved.accent, vision: ColorVision::Off };
+ let look = icon_svg::Look::themed(dark, resolved.accent, ColorVision::Off);
let pm = icon_svg::render(icon_svg::doc_for(resolved.master, px).unwrap(), look, px).unwrap();
sheet.draw_pixmap(x, row as i32 * 88 + 8, pm.as_ref(), &tiny_skia::PixmapPaint::default(), tiny_skia::Transform::identity(), None);
x += px as i32 + 16;
diff --git a/docs/book/src/guide/ui-tour.md b/docs/book/src/guide/ui-tour.md
index e651c8b2a3..97593d1e08 100644
--- a/docs/book/src/guide/ui-tour.md
+++ b/docs/book/src/guide/ui-tour.md
@@ -120,7 +120,7 @@ Gruvbox themes (dark and light, each in hard, normal and soft contrast) and any
imported. A choice applies at once.
A theme is a small JSON file that starts from the Dark or Light palette and changes any of its
-colours by name:
+colours and corner radii by name:
```json
{
@@ -134,6 +134,14 @@ colours by name:
"viewport_top": "#32302f",
"viewport_bottom": "#32302f",
"triad": ["#fb4934", "#b8bb26", "#83a598"]
+ },
+ "radii": {
+ "radius_sm": 2,
+ "radius_md": 4,
+ "radius_lg": 6,
+ "radius_xl": 8,
+ "control_radius": 4,
+ "sketch_mode_radius": 4
}
}
```
@@ -141,6 +149,16 @@ colours by name:
Colours are `#rrggbb`, or `#rrggbbaa` for translucent ones. A few colours, such as the view
triad's X, Y and Z, take a list. Any colour the file leaves out keeps the base palette's value.
+`radii` is optional. Its six keys above accept integers from 0 to 32 in logical UI points;
+zero makes square corners. Omitted keys keep today's base values: 4, 6, 8, 10, 6 and 7,
+respectively. The first four style small accents through large surfaces; `control_radius`
+styles form controls, and `sketch_mode_radius` styles sketch creation buttons. Themes own
+these settings, with matching shapes across light and dark variants. Dock joins remain
+square, circular controls remain circular, and control sizes and spacing stay the same.
+Platinum 9 and the phosphor themes use square corners, SolidCraft 95 uses subtle 3-point
+corners, Blueprint uses the standard radii, and Cupertino uses softer corners. Other built-in
+themes retain the defaults.
+
Tab accents also have separate fill, small-text ink and tint keys. Sketch uses
`sketch_accent`, `sketch_ink`, `sketch_soft`; Surface, Mesh, Sheet Metal and Render
use `<tab>_fill`, `<tab>_ink`, `<tab>_soft` (`sheet` for Sheet Metal). Form uses
@@ -154,7 +172,7 @@ pills when `on_accent` has less than 4.5:1 contrast with the fill. See the
- **Import…** adds a theme file and turns it on. Importing a file with the same name again updates
that theme. A file with an unknown colour name or a malformed colour is refused, and the message
names every problem.
-- **Export…** saves the theme on now as a complete file listing every colour. It is a good starting
+- **Export…** saves the theme on now as a complete file listing every colour and radius. It is a good starting
point for your own theme.
- **Remove** deletes the selected imported theme.
@@ -187,3 +205,22 @@ lightly damped spring transition and a small boundary margin to prevent flicker.
On desktop, Ctrl/Cmd+Plus (or Equals) enlarges the interface, Ctrl/Cmd+Minus reduces it,
and Ctrl/Cmd+0 restores 100%. These shortcuts update the UI scale preference. The UI scale
slider in Preferences applies the new layout when released, so it stays still while dragging.
+
+
+Theme files can also define `borders`: `primary` outer outlines, `secondary` major section
+rules, `tertiary` small dividers, `container` solid preview/card/keycap outlines, and independent
+`control` outlines. Each accepts a `width`
+from 0 to 4 UI points and a `color` in hex. Optional `primary_inset` adds a companion outline
+inside panel chrome, with a `gap` from 0 to 12 points. Missing settings keep existing borders.
+Blueprint uses a single white outer outline, dotted section lines and dark minor dividers. Secondary rules optionally accept `pattern: "dotted"`; the default is `solid`. Focus, selection and
+error outlines retain their semantic colours. See the UI-kit border hierarchy for the schema.
+
+SolidCraft 95 also defines optional `borders.bevel`: a per-band `width` and the
+`highlight`, `light`, `shadow` and `dark_shadow` colours. The shared UI uses these
+for raised panels/buttons, recessed fields and reversed pressed-button lighting.
+Themes that omit this setting keep their existing flat borders.
+
+Theme files may also set `icon_palette`: opaque colours for SVG display roles,
+and three-colour pale/medium/strong ramps for Solid, Surface, Mesh, Form, Sketch,
+constraints and construction. These settings colour the existing command artwork
+without changing its shapes. Omitted roles keep the default light/dark palette.
diff --git a/docs/theme-colour-audit.md b/docs/theme-colour-audit.md
new file mode 100644
index 0000000000..503e1c1618
--- /dev/null
+++ b/docs/theme-colour-audit.md
@@ -0,0 +1,65 @@
+# Theme colour audit (#5007)
+
+The audit covers all 20 shipped theme files and the shared SVG icon/tab rendering paths.
+This work stacks on the theme radii and border changes (#4923, #4954).
+
+## Findings and decisions
+
+- Command SVGs previously read only the compiled light/dark palette. The existing
+ `colors.icon` and `colors.icons.*` settings colour other markers/controls, not
+ SVG active faces, passive faces or contours. Optional `icon_palette` overrides
+ now supply those roles without editing accepted artwork or semantic aliases.
+- Texture identity previously contained light/dark mode, semantic accent, size and
+ finish, but no theme palette. It now includes the resolved palette; switching
+ palettes frees the previous theme's cached textures. Forced-dark app-bar icons
+ coexist with themed icons without repeatedly clearing the cache.
+- Eleven files repeated one fill across Surface, Mesh, Form, Sheet Metal and Render.
+ Six Gruvbox files inherited those workspace settings from the default UI palette.
+ All files now define the seven workspace colours, paired ink and soft surfaces.
+- The six Gruvbox variants omitted form/dialog tokens, leaving Preferences and
+ other form surfaces in the default light/dark palette. They now explicitly
+ colour dialog bodies, footers, rules, controls, text, selection and status states.
+- Text on soft Model selections incorrectly reused solid-selection ink even when
+ its contrast was insufficient (notably 95). The tab chooses a readable theme ink.
+ Selected preview metadata now uses selected text ink instead of dim body text.
+
+| Family | Colour treatment |
+| --- | --- |
+| Gruvbox dark/light, normal/hard/soft | Blue, orange, yellow, purple, aqua, red and green from the family palette; shared accent geometry across contrast variants |
+| Nord, Tokyo Night, Catppuccin Mocha, Nosferatu | Distinct workspace hues within each palette's muted or pastel character |
+| Cupertino, One Dark | Retain their semantic workspace families, with matching shaded SVG ramps |
+| Blueprint | Chalk-like faces, blue passive geometry and restrained workspace hues |
+| Graphite, Platinum 9 | Muted, distinct workspace colours over neutral chrome |
+| Solarized Light | Solarized workspace hues and warm neutral icon faces |
+| High Contrast | Strong outlines and readable saturated workspace colours |
+| SolidCraft 95 | Classic grey icon geometry; navy, brown, olive, purple, teal, burgundy and green workspace accents |
+| Amber/Green Phosphor | Deliberately single-hue palettes, with different intensities for workspace groups |
+
+Shared utility tabs (Assemble, Insert, Inspect, Manage, View) retain the Model
+family. The seven workspace groups are Model, Surface, Mesh, Form, Sheet Metal,
+Render and Sketch. Their labels remain the primary identifier; colour supplements them.
+
+## Theme file contract
+
+`solidcraft-theme/1` accepts an optional `icon_palette` object. Single opaque hex
+colours override `ink`, `line`, `guide`, `passive-1/2/3` and `active-1/2/3`.
+Three-colour arrays, ordered pale face / medium face / strong stroke, override
+`solid`, `surface`, `mesh`, `form`, `sketch`, `constraint` and `construction` ramps.
+A missing role/ramp retains the compiled palette. A base Solid override never
+recolours an omitted semantic ramp. Unknown names, incorrect array lengths,
+translucency and overrides of the transparent GAP eraser are rejected.
+
+Import/export and direct preference updates use the same validation. Invalid
+hand-edited saved palettes fall back safely. The default Light/Dark palettes stay
+unchanged. SVG outlines, guides, passive face ordering, masks, knockouts and alpha
+remain intact. Explicit monochrome controls keep their surface-specific ink;
+colour-vision variants take precedence over conflicting theme ramp entries.
+
+Most custom ramps match the base ramp's OKLab lightness per face, with chroma
+reduced to stay in sRGB. Phosphor intensities and 95's classic palette are deliberate
+exceptions. Workspace ink/soft and solid-tab pairs are checked for 4.5:1 text contrast.
+
+## Separate work
+
+Home/File colour inheritance is owned by #4868 / #4924 and is not duplicated here.
+Radii, borders, bevels and SVG artwork/assignments remain owned by their existing changes.
diff --git a/docs/ui-kit.md b/docs/ui-kit.md
index 9b6b2d7fcf..4f274ebaea 100644
--- a/docs/ui-kit.md
+++ b/docs/ui-kit.md
@@ -468,3 +468,84 @@ native button used by `button` inside a bounded, centred layout. It preserves
stable identity, enabled state and exact caller-owned geometry. Recovery actions
use this component rather than custom button painters. The recovery well renders
the existing restore artwork through its construction accent ramp.
+
+
+### Theme corner radii
+
+Theme files may override `radius_sm`, `radius_md`, `radius_lg`, `radius_xl`,
+`control_radius` and `sketch_mode_radius` in an optional `radii` object (integer
+UI points, 0–32). Missing entries retain the base palette's shape. Light and dark
+variants of a family should use identical values. Import/export and preferences
+retain these overrides; colour vision modes leave them alone.
+
+Use `Tokens` for decorative UI corners, including hover, selection, focus,
+image thumbnails, popups and nested surfaces. Small legacy accents derive their
+radius from the small token so the default appearance stays unchanged. Expanded
+outlines use `Tokens::outset_radius` so square corners stay square. `Container`
+continues to own outer surface chrome and square dock contacts. Functional
+geometry (circles, model selection boxes, plot clipping, manipulator handles
+and the artwork inside icons) retains its own shape.
+
+## Theme border hierarchy
+
+Three structural levels distinguish outer chrome, major section rules and minor dividers.
+Separate solid container and control roles keep enclosing boxes independent of divider patterns.
+
+| Role | UI audit / assignment |
+| --- | --- |
+| Primary | Ribbon/workspace cards, Browser/History, feature and palette sheets, system windows, menus/popups, navigation/status surfaces |
+| Secondary | Ribbon tab/content rule, Browser/History heading rule, feature/window header and footer, Preferences page/navigation division, disclosure section rules, Assistant header/composer division, File navigation sections |
+| Tertiary | Ribbon category dividers, menu groups, report/table rows, neutral History items, File cards/thumbnails, ordinary inherited egui separators |
+| Container | Settings previews, information cards, list/detail wells, Assistant content cards, shortcut keycaps |
+| Control | Neutral fields, buttons, checkboxes, segmented choices and search inputs |
+
+Focus, selection, active commands, errors, recovery warnings and status keep their existing
+semantic strokes. Icon artwork, example mouse diagrams, plots, model edges, manipulator
+geometry and the compass are content; structural border roles do not recolour them.
+
+`solidcraft-theme/1` optionally accepts `borders`. Each role has a `width` (finite 0–4
+logical UI points; zero hides the stroke) and a `color` (`#rrggbb` or `#rrggbbaa`).
+`primary_inset` also requires `gap` (finite 0–12 points of clear distance inside the
+primary border). This companion is painted inside panel/ribbon/window/menu chrome,
+without extra input targets or layout space; tiny surfaces omit it. Compact contacts
+remain square and collapse adjoining primary strokes. Other ornament, such as the
+circular compass and native widget-owned tooltip content, does not acquire an inset.
+
+```json
+"borders": {
+ "primary": {"width": 1, "color": "#ffffff"},
+ "secondary": {"width": 1, "color": "#e5efff", "pattern": "dotted"},
+ "tertiary": {"width": 1, "color": "#102748"},
+ "container": {"width": 1, "color": "#a8c8ed"},
+ "control": {"width": 1, "color": "#a8c8ed"}
+}
+```
+
+Those are Blueprint's settings: a single primary outline and dotted secondary rules. Secondary roles optionally accept `pattern`: `solid` (default) or `dotted`; this pattern follows horizontal/vertical section rules. Container outlines remain solid, as do the other roles. Themes without border settings retain their previous appearance.
+SolidCraft 95 uses silver surfaces and directional two-band bevels: light top/left
+edges and dark bottom/right edges for raised panels and buttons, reversed for
+recessed fields and pressed buttons. Inputs use the `field` colour independently
+of the neutral button face. Disabled controls fade their bevel; focus, selection
+and validation keep their semantic indicators. Solid grey rules divide sections.
+
+Optional `borders.bevel` enables this shared container/control treatment. It accepts
+`width` (finite, greater than 0 and at most 2 points per band), `highlight`, `light`,
+`shadow` and `dark_shadow` (hex colours). Missing bevel settings preserve flat
+rendering exactly. The bands paint inside existing rounded or square geometry
+without changing hit targets or allocation. Ghost controls remain borderless.
+Missing roles preserve each surface's existing width and colour, including overrides in
+`colors`; exporting keeps omitted roles absent so reimport cannot flatten those legacy
+surface differences. Dark/Light and the Gruvbox families share border geometry.
+Imports and direct preference updates reject unknown roles/settings, invalid colours,
+non-finite/out-of-range numbers and missing required settings. Invalid hand-edited saved
+border settings safely fall back to legacy styling. The optional field requires no format
+version change. There is no general border editor in Preferences; theme file import/export
+and the existing preference/control workflow own this extension.
+
+## Theme icon and tab colours
+
+Theme files optionally supply `icon_palette` SVG roles and semantic ramps. The
+shared renderer snapshots that palette into the icon look and cache identity;
+callers continue to request semantic icon IDs and surface-specific monochrome ink.
+See [the shipped-theme colour audit](theme-colour-audit.md) for the schema,
+workspace assignments, accessibility rules and intentionally monochrome themes.