Skip to content

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

Sketch dimensions in their own colour in every theme (#7861) (#8124)

PaddleStroke79f53a099910
diff --git a/assets/styles/ui/palettes.rs b/assets/styles/ui/palettes.rs
index 020601453d..59da0e3ce0 100644
--- a/assets/styles/ui/palettes.rs
+++ b/assets/styles/ui/palettes.rs
@@ -193,8 +193,10 @@ impl Tokens {
sketch_halo: Color32::from_rgb(240, 243, 247),
sketch_point: Color32::BLACK,
sketch_locked: Color32::from_rgb(0, 140, 60),
- dimension: Color32::from_rgb(36, 40, 48),
- dimension_driven: Color32::from_rgb(120, 126, 138),
+ // Sketch dimensions in a plum of their own, apart from the blue and black curves for
+ // every colour vision mode (#7861).
+ dimension: Color32::from_rgb(130, 42, 110),
+ dimension_driven: Color32::from_rgb(160, 90, 120),
sketch_point_free: Color32::from_rgb(30, 90, 200),
section_cap: Color32::from_rgb(214, 128, 72),
dialog_bg: Color32::from_rgb(250, 251, 252),
@@ -358,8 +360,9 @@ impl Tokens {
t.sketch_halo = Color32::from_rgb(28, 32, 40);
t.sketch_point = Color32::from_rgb(232, 234, 238);
t.sketch_locked = Color32::from_rgb(96, 204, 116);
- t.dimension = Color32::from_rgb(224, 228, 234);
- t.dimension_driven = Color32::from_rgb(142, 150, 164);
+ // Sketch dimensions: Light's plum, lightened for the dark view (#7861).
+ t.dimension = Color32::from_rgb(224, 176, 224);
+ t.dimension_driven = Color32::from_rgb(176, 104, 144);
t.sketch_point_free = Color32::from_rgb(92, 150, 255);
t.profile_fill = Color32::from_rgba_unmultiplied_const(120, 150, 200, 40);
t.dialog_bg = Color32::from_rgb(39, 43, 52);
diff --git a/assets/styles/ui/themes/akari.json b/assets/styles/ui/themes/akari.json
index 87880d728a..a9d158a66e 100644
--- a/assets/styles/ui/themes/akari.json
+++ b/assets/styles/ui/themes/akari.json
@@ -50,8 +50,8 @@
"dialog_footer": "#efece8",
"dialog_label": "#403d38",
"dialog_rule": "#d9d5d0",
- "dimension": "#403d38",
- "dimension_driven": "#6c6863",
+ "dimension": "#006a70",
+ "dimension_driven": "#4d8a8c",
"error": "#c71529",
"field": "#fffdfa",
"file_rail": "#e1ddd8",
diff --git a/assets/styles/ui/themes/amber-phosphor.json b/assets/styles/ui/themes/amber-phosphor.json
index d31514e2a8..7cade1761d 100644
--- a/assets/styles/ui/themes/amber-phosphor.json
+++ b/assets/styles/ui/themes/amber-phosphor.json
@@ -50,8 +50,8 @@
"dialog_footer": "#100b04",
"dialog_label": "#f3ca87",
"dialog_rule": "#3b280d",
- "dimension": "#ffe2a5",
- "dimension_driven": "#9b6922",
+ "dimension": "#f5e050",
+ "dimension_driven": "#a8962e",
"error": "#fff0ca",
"field": "#100b04",
"form_accent": "#ca892b",
diff --git a/assets/styles/ui/themes/blueprint.json b/assets/styles/ui/themes/blueprint.json
index e2d49c2718..51e45ffee1 100644
--- a/assets/styles/ui/themes/blueprint.json
+++ b/assets/styles/ui/themes/blueprint.json
@@ -50,8 +50,8 @@
"dialog_footer": "#0c223c",
"dialog_label": "#e3f0fa",
"dialog_rule": "#254764",
- "dimension": "#e3f0fa",
- "dimension_driven": "#94b2cb",
+ "dimension": "#ffd970",
+ "dimension_driven": "#c9a95a",
"error": "#ff968d",
"field": "#071d35",
"form_accent": "#baade8",
diff --git a/assets/styles/ui/themes/catppuccin-mocha.json b/assets/styles/ui/themes/catppuccin-mocha.json
index b8f217453c..c95372cb51 100644
--- a/assets/styles/ui/themes/catppuccin-mocha.json
+++ b/assets/styles/ui/themes/catppuccin-mocha.json
@@ -50,8 +50,8 @@
"dialog_footer": "#1e1e2e",
"dialog_label": "#cdd6f4",
"dialog_rule": "#45475a",
- "dimension": "#cdd6f4",
- "dimension_driven": "#a6adc8",
+ "dimension": "#94e2d5",
+ "dimension_driven": "#6c9d95",
"error": "#f38ba8",
"field": "#181825",
"form_accent": "#a9b2f2",
diff --git a/assets/styles/ui/themes/cga.json b/assets/styles/ui/themes/cga.json
index d3070d7777..d7be4b7c8a 100644
--- a/assets/styles/ui/themes/cga.json
+++ b/assets/styles/ui/themes/cga.json
@@ -45,8 +45,8 @@
"dialog_footer": "#000000",
"dialog_label": "#55ffff",
"dialog_rule": "#00aaaa",
- "dimension": "#ffffff",
- "dimension_driven": "#aaaaaa",
+ "dimension": "#ffff55",
+ "dimension_driven": "#aa5500",
"error": "#ff5555",
"field": "#000000",
"file_background": "#000000",
diff --git a/assets/styles/ui/themes/clay-dark.json b/assets/styles/ui/themes/clay-dark.json
index cc78eeea93..2a154eacba 100644
--- a/assets/styles/ui/themes/clay-dark.json
+++ b/assets/styles/ui/themes/clay-dark.json
@@ -50,8 +50,8 @@
"dialog_footer": "#29241f",
"dialog_label": "#c3bdb5",
"dialog_rule": "#403930",
- "dimension": "#c3bdb5",
- "dimension_driven": "#9d9285",
+ "dimension": "#5fc4c0",
+ "dimension_driven": "#4f9895",
"error": "#f85052",
"field": "#3c352d",
"form_accent": "#a6a2fc",
diff --git a/assets/styles/ui/themes/clay.json b/assets/styles/ui/themes/clay.json
index ea70b9d420..d4a6b84edf 100644
--- a/assets/styles/ui/themes/clay.json
+++ b/assets/styles/ui/themes/clay.json
@@ -50,8 +50,8 @@
"dialog_footer": "#f4eee3",
"dialog_label": "#423e36",
"dialog_rule": "#e0d8c9",
- "dimension": "#423e36",
- "dimension_driven": "#726a5d",
+ "dimension": "#006a70",
+ "dimension_driven": "#4a8688",
"error": "#c71529",
"field": "#fdfaf3",
"form_accent": "#5844bc",
diff --git a/assets/styles/ui/themes/cupertino.json b/assets/styles/ui/themes/cupertino.json
index cadc2199e9..a82c4b0d21 100644
--- a/assets/styles/ui/themes/cupertino.json
+++ b/assets/styles/ui/themes/cupertino.json
@@ -50,8 +50,8 @@
"dialog_footer": "#ececec",
"dialog_label": "#262628",
"dialog_rule": "#c6c6c8",
- "dimension": "#262628",
- "dimension_driven": "#6e6e73",
+ "dimension": "#00646b",
+ "dimension_driven": "#3d8087",
"error": "#d53137",
"field": "#ffffff",
"form_accent": "#8b62bf",
diff --git a/assets/styles/ui/themes/graphite.json b/assets/styles/ui/themes/graphite.json
index 3f96ec69f9..87d4675a17 100644
--- a/assets/styles/ui/themes/graphite.json
+++ b/assets/styles/ui/themes/graphite.json
@@ -50,8 +50,8 @@
"dialog_footer": "#25272b",
"dialog_label": "#e0e2e5",
"dialog_rule": "#484d55",
- "dimension": "#e0e2e5",
- "dimension_driven": "#a0a6b0",
+ "dimension": "#5fd0c8",
+ "dimension_driven": "#4a9a95",
"error": "#ed7777",
"field": "#1c1e21",
"form_accent": "#a08fc4",
diff --git a/assets/styles/ui/themes/green-phosphor.json b/assets/styles/ui/themes/green-phosphor.json
index fe4d23605f..ae347d68b4 100644
--- a/assets/styles/ui/themes/green-phosphor.json
+++ b/assets/styles/ui/themes/green-phosphor.json
@@ -50,8 +50,8 @@
"dialog_footer": "#061009",
"dialog_label": "#8def9f",
"dialog_rule": "#173b22",
- "dimension": "#8def9f",
- "dimension_driven": "#5b9b6a",
+ "dimension": "#c8ff4d",
+ "dimension_driven": "#7fa040",
"error": "#d8ffdf",
"field": "#061009",
"form_accent": "#1faa4e",
diff --git a/assets/styles/ui/themes/gruvbox-dark-hard.json b/assets/styles/ui/themes/gruvbox-dark-hard.json
index 9a55880c5c..87f00df6f1 100644
--- a/assets/styles/ui/themes/gruvbox-dark-hard.json
+++ b/assets/styles/ui/themes/gruvbox-dark-hard.json
@@ -55,8 +55,8 @@
"sketch_fixed": "#ebdbb2",
"sketch_halo": "#141617",
"sketch_locked": "#b8bb26",
- "dimension": "#ebdbb2",
- "dimension_driven": "#928374",
+ "dimension": "#fabd2f",
+ "dimension_driven": "#b57614",
"sketch_point": "#ebdbb2",
"sketch_point_free": "#83a598",
"dialog_bg": "#3c3836",
diff --git a/assets/styles/ui/themes/gruvbox-dark-soft.json b/assets/styles/ui/themes/gruvbox-dark-soft.json
index 46886b6b10..88afd43f24 100644
--- a/assets/styles/ui/themes/gruvbox-dark-soft.json
+++ b/assets/styles/ui/themes/gruvbox-dark-soft.json
@@ -56,8 +56,8 @@
"sketch_fixed": "#ebdbb2",
"sketch_halo": "#1d2021",
"sketch_locked": "#b8bb26",
- "dimension": "#ebdbb2",
- "dimension_driven": "#928374",
+ "dimension": "#fabd2f",
+ "dimension_driven": "#b57614",
"sketch_point": "#ebdbb2",
"sketch_point_free": "#83a598",
"dialog_bg": "#3c3836",
diff --git a/assets/styles/ui/themes/gruvbox-dark.json b/assets/styles/ui/themes/gruvbox-dark.json
index c1df0ef53f..34635540d9 100644
--- a/assets/styles/ui/themes/gruvbox-dark.json
+++ b/assets/styles/ui/themes/gruvbox-dark.json
@@ -56,8 +56,8 @@
"sketch_fixed": "#ebdbb2",
"sketch_halo": "#1d2021",
"sketch_locked": "#b8bb26",
- "dimension": "#ebdbb2",
- "dimension_driven": "#928374",
+ "dimension": "#fabd2f",
+ "dimension_driven": "#b57614",
"sketch_point": "#ebdbb2",
"sketch_point_free": "#83a598",
"dialog_bg": "#3c3836",
diff --git a/assets/styles/ui/themes/gruvbox-light-hard.json b/assets/styles/ui/themes/gruvbox-light-hard.json
index d1ca6d8312..e0f148f451 100644
--- a/assets/styles/ui/themes/gruvbox-light-hard.json
+++ b/assets/styles/ui/themes/gruvbox-light-hard.json
@@ -55,8 +55,8 @@
"sketch_fixed": "#282828",
"sketch_halo": "#fbf8e3",
"sketch_locked": "#79740e",
- "dimension": "#3c3836",
- "dimension_driven": "#7c6f64",
+ "dimension": "#1f5c40",
+ "dimension_driven": "#4f7d64",
"sketch_point": "#282828",
"sketch_point_free": "#076678",
"dialog_bg": "#f9f5d7",
diff --git a/assets/styles/ui/themes/gruvbox-light-soft.json b/assets/styles/ui/themes/gruvbox-light-soft.json
index 5e2b883e8e..91b8c4399d 100644
--- a/assets/styles/ui/themes/gruvbox-light-soft.json
+++ b/assets/styles/ui/themes/gruvbox-light-soft.json
@@ -55,8 +55,8 @@
"sketch_fixed": "#282828",
"sketch_halo": "#f6edd0",
"sketch_locked": "#79740e",
- "dimension": "#3c3836",
- "dimension_driven": "#7c6f64",
+ "dimension": "#1f5c40",
+ "dimension_driven": "#4f7d64",
"sketch_point": "#282828",
"sketch_point_free": "#076678",
"dialog_bg": "#f2e5bc",
diff --git a/assets/styles/ui/themes/gruvbox-light.json b/assets/styles/ui/themes/gruvbox-light.json
index f2c28197c9..05787738f4 100644
--- a/assets/styles/ui/themes/gruvbox-light.json
+++ b/assets/styles/ui/themes/gruvbox-light.json
@@ -55,8 +55,8 @@
"sketch_fixed": "#282828",
"sketch_halo": "#fcf5d8",
"sketch_locked": "#79740e",
- "dimension": "#3c3836",
- "dimension_driven": "#7c6f64",
+ "dimension": "#1f5c40",
+ "dimension_driven": "#4f7d64",
"sketch_point": "#282828",
"sketch_point_free": "#076678",
"dialog_bg": "#fbf1c7",
diff --git a/assets/styles/ui/themes/high-contrast.json b/assets/styles/ui/themes/high-contrast.json
index ec2c1523bf..8dd1515c87 100644
--- a/assets/styles/ui/themes/high-contrast.json
+++ b/assets/styles/ui/themes/high-contrast.json
@@ -50,8 +50,8 @@
"dialog_footer": "#000000",
"dialog_label": "#ffffff",
"dialog_rule": "#a0a0a0",
- "dimension": "#ffffff",
- "dimension_driven": "#cccccc",
+ "dimension": "#ffff66",
+ "dimension_driven": "#c8c850",
"error": "#ff6666",
"field": "#000000",
"form_accent": "#d98af9",
diff --git a/assets/styles/ui/themes/nord.json b/assets/styles/ui/themes/nord.json
index 744abda812..e9eb44732e 100644
--- a/assets/styles/ui/themes/nord.json
+++ b/assets/styles/ui/themes/nord.json
@@ -50,8 +50,8 @@
"dialog_footer": "#2e3440",
"dialog_label": "#eceff4",
"dialog_rule": "#4c566a",
- "dimension": "#eceff4",
- "dimension_driven": "#a4b0c2",
+ "dimension": "#d08770",
+ "dimension_driven": "#a87060",
"error": "#bf616a",
"field": "#242933",
"form_accent": "#cfa7c7",
diff --git a/assets/styles/ui/themes/nosferatu.json b/assets/styles/ui/themes/nosferatu.json
index 394d8e2401..1702b071e2 100644
--- a/assets/styles/ui/themes/nosferatu.json
+++ b/assets/styles/ui/themes/nosferatu.json
@@ -50,8 +50,8 @@
"dialog_footer": "#282a36",
"dialog_label": "#f8f8f2",
"dialog_rule": "#50546d",
- "dimension": "#f8f8f2",
- "dimension_driven": "#a1a4c4",
+ "dimension": "#8be9fd",
+ "dimension_driven": "#62a3b1",
"error": "#ff5555",
"field": "#21222c",
"form_accent": "#c096e8",
diff --git a/assets/styles/ui/themes/okibi.json b/assets/styles/ui/themes/okibi.json
index fe225ade37..34a87bfd52 100644
--- a/assets/styles/ui/themes/okibi.json
+++ b/assets/styles/ui/themes/okibi.json
@@ -50,8 +50,8 @@
"dialog_footer": "#1b1e20",
"dialog_label": "#bbbec1",
"dialog_rule": "#2f3235",
- "dimension": "#bbbec1",
- "dimension_driven": "#8f9296",
+ "dimension": "#5fc4c0",
+ "dimension_driven": "#4f9895",
"error": "#f85052",
"field": "#2c2e31",
"file_rail": "#0f1113",
diff --git a/assets/styles/ui/themes/one-dark.json b/assets/styles/ui/themes/one-dark.json
index 18f2673698..e616e1f58c 100644
--- a/assets/styles/ui/themes/one-dark.json
+++ b/assets/styles/ui/themes/one-dark.json
@@ -50,8 +50,8 @@
"dialog_footer": "#2f343e",
"dialog_label": "#b4bbc8",
"dialog_rule": "#353b47",
- "dimension": "#abb2bf",
- "dimension_driven": "#7f848e",
+ "dimension": "#56b6c2",
+ "dimension_driven": "#3f8590",
"error": "#e06c75",
"field": "#1e2227",
"form_accent": "#d283e9",
diff --git a/assets/styles/ui/themes/platinum-9.json b/assets/styles/ui/themes/platinum-9.json
index d98fa09aef..7fb1f5f683 100644
--- a/assets/styles/ui/themes/platinum-9.json
+++ b/assets/styles/ui/themes/platinum-9.json
@@ -50,8 +50,8 @@
"dialog_footer": "#dddddd",
"dialog_label": "#222222",
"dialog_rule": "#aaaaaa",
- "dimension": "#222222",
- "dimension_driven": "#666666",
+ "dimension": "#00787f",
+ "dimension_driven": "#4d9196",
"error": "#bb3333",
"field": "#ffffff",
"form_accent": "#704e81",
diff --git a/assets/styles/ui/themes/solarized-light.json b/assets/styles/ui/themes/solarized-light.json
index 18534f817a..e5c7adb0d5 100644
--- a/assets/styles/ui/themes/solarized-light.json
+++ b/assets/styles/ui/themes/solarized-light.json
@@ -50,8 +50,8 @@
"dialog_footer": "#eee8d5",
"dialog_label": "#586e75",
"dialog_rule": "#b6b3a1",
- "dimension": "#586e75",
- "dimension_driven": "#657b83",
+ "dimension": "#136059",
+ "dimension_driven": "#3d8f88",
"error": "#dc322f",
"field": "#fdf6e3",
"form_accent": "#6b70c3",
diff --git a/assets/styles/ui/themes/solidcraft-95.json b/assets/styles/ui/themes/solidcraft-95.json
index 8e58b07f02..3cd974ec79 100644
--- a/assets/styles/ui/themes/solidcraft-95.json
+++ b/assets/styles/ui/themes/solidcraft-95.json
@@ -50,8 +50,8 @@
"dialog_footer": "#c0c0c0",
"dialog_label": "#000000",
"dialog_rule": "#808080",
- "dimension": "#000000",
- "dimension_driven": "#808080",
+ "dimension": "#ffffff",
+ "dimension_driven": "#ffff00",
"error": "#ff0000",
"field": "#ffffff",
"form_accent": "#800080",
diff --git a/assets/styles/ui/themes/tokyo-night.json b/assets/styles/ui/themes/tokyo-night.json
index 2608ea9d21..1897ee42f2 100644
--- a/assets/styles/ui/themes/tokyo-night.json
+++ b/assets/styles/ui/themes/tokyo-night.json
@@ -50,8 +50,8 @@
"dialog_footer": "#1a1b26",
"dialog_label": "#c0caf5",
"dialog_rule": "#414868",
- "dimension": "#c0caf5",
- "dimension_driven": "#9aa5ce",
+ "dimension": "#73daca",
+ "dimension_driven": "#4f9a90",
"error": "#f7768e",
"field": "#16161e",
"form_accent": "#b190ec",
diff --git a/crates/ui-egui/src/colour_vision_tests.rs b/crates/ui-egui/src/colour_vision_tests.rs
index 76451ff090..9751765728 100644
--- a/crates/ui-egui/src/colour_vision_tests.rs
+++ b/crates/ui-egui/src/colour_vision_tests.rs
@@ -295,6 +295,20 @@ fn groups(t: &Tokens) -> Vec<Group> {
group("axes", &[("axis_x", t.axis_x), ("axis_y", t.axis_y), ("axis_z", t.axis_z)], &[("viewport_top", t.viewport_top)]),
group("bend lines", &[("bend_up", t.bend_up), ("bend_down", t.bend_down)], &[("viewport_top", t.viewport_top)]),
group("box select", &[("box_window", t.box_window), ("box_crossing", t.box_crossing)], &[("viewport_top", t.viewport_top)]),
+ // Sketch dimensions (#7861): their lines and values, driving and driven, apart from the
+ // curves they measure, the construction lines and the conflict red (each its own group:
+ // those three are measured against each other elsewhere).
+ group(
+ "sketch dimensions",
+ &[("dimension", t.dimension), ("dimension_driven", t.dimension_driven), ("sketch", t.sketch), ("sketch_fixed", t.sketch_fixed)],
+ &[("viewport_top", t.viewport_top), ("viewport_bottom", t.viewport_bottom)],
+ ),
+ group(
+ "dimensions and construction",
+ &[("dimension", t.dimension), ("dimension_driven", t.dimension_driven), ("sketch_construction", t.sketch_construction)],
+ &[],
+ ),
+ group("dimensions and conflicts", &[("dimension", t.dimension), ("dimension_driven", t.dimension_driven), ("error", t.error)], &[]),
group(
"selection",
&[
@@ -529,8 +543,6 @@ const NO_MEANING: &[(&str, &str)] = &[
("grid", "the grid"),
("grid_major", "the grid"),
("profile_fill", "a closed profile's tint"),
- ("dimension", "dimension text"),
- ("dimension_driven", "dimension text, dimmed"),
("glyph_bg", "a constraint glyph's ground"),
("glyph_edge", "a constraint glyph's edge"),
// The navigation cube: labelled faces.
@@ -864,6 +876,51 @@ fn validation_badges_are_distinct_and_readable_in_every_mode() {
assert!(failures.is_empty(), "{}", failures.join("\n"));
}
+/// Every shipped theme draws sketch dimensions in a colour of their own (#7861): apart from the
+/// sketch curves, construction lines, the conflict red and the hover and selection accent, and
+/// readable on the viewport — a driving value as text, a driven one as a dimmed line. The
+/// two-colour themes (1-bit) tell them apart by shape alone.
+#[test]
+fn shipped_themes_draw_dimensions_in_their_own_readable_colour() {
+ use crate::theme::contrast_ratio;
+ use crate::theme_files::{builtin, is_two_colour, resolve};
+ let themes = [("light", Tokens::light()), ("dark", Tokens::dark())]
+ .into_iter()
+ .map(|(id, t)| (id.to_string(), t))
+ .chain(builtin().iter().filter(|f| !is_two_colour(&f.id)).map(|f| (f.id.clone(), resolve(f))));
+ let mut failures = Vec::new();
+ for (id, t) in themes {
+ for (name, dim, min_contrast) in [("dimension", t.dimension, 4.5), ("dimension_driven", t.dimension_driven, 3.0)] {
+ for (ground, g) in [("viewport_top", t.viewport_top), ("viewport_bottom", t.viewport_bottom)] {
+ let c = contrast_ratio(dim, g);
+ if c < min_contrast {
+ failures.push(format!("{id}: {name} on {ground}: contrast {c:.2}"));
+ }
+ }
+ let others = [
+ ("sketch", t.sketch),
+ ("sketch_fixed", t.sketch_fixed),
+ ("sketch_locked", t.sketch_locked),
+ ("sketch_projected", t.sketch_projected),
+ ("sketch_construction", t.sketch_construction),
+ ("error", t.error),
+ ("accent", t.accent),
+ ];
+ for (other, o) in others {
+ let d = normal(rgb(dim), rgb(o));
+ if d < FLOOR {
+ failures.push(format!("{id}: {name} vs {other}: {d:.1}"));
+ }
+ }
+ }
+ let d = normal(rgb(t.dimension), rgb(t.dimension_driven));
+ if d < FLOOR {
+ failures.push(format!("{id}: dimension vs dimension_driven: {d:.1}"));
+ }
+ }
+ assert!(failures.is_empty(), "{}", failures.join("\n"));
+}
+
#[test]
fn the_shader_gets_the_modes_colours_and_its_stripes() {
for dark in [false, true] {
diff --git a/crates/ui-egui/src/dim_view.rs b/crates/ui-egui/src/dim_view.rs
index a0e02751bb..b5084274ed 100644
--- a/crates/ui-egui/src/dim_view.rs
+++ b/crates/ui-egui/src/dim_view.rs
@@ -1023,6 +1023,53 @@ mod tests {
}
}
+ /// A sketch's dimensions draw their lines and arrows in the theme's dimension colours,
+ /// driving and driven, never in the colour of the curves they measure (#7861).
+ #[test]
+ fn dimensions_are_drawn_in_the_dimension_colours() {
+ fn strokes(s: &Shape, out: &mut std::collections::BTreeSet<[u8; 4]>) {
+ match s {
+ Shape::LineSegment { stroke, .. } => {
+ out.insert(stroke.color.to_array());
+ }
+ Shape::Path(p) => {
+ if let egui::epaint::ColorMode::Solid(c) = p.stroke.color {
+ out.insert(c.to_array());
+ }
+ }
+ Shape::Vec(v) => v.iter().for_each(|s| strokes(s, out)),
+ _ => {}
+ }
+ }
+ cancel();
+ let mut h = crate::scenario::Harness::new();
+ h.app.home.open = false;
+ h.app.run("sketch.create", json!({"plane":"XY"})).unwrap();
+ let mut line = |y: f64| {
+ h.app.run("sketch.line", json!({"points":[[0,y],[30,y]],"connect":false,"infer":false})).unwrap()["curves"][0]
+ .as_str()
+ .unwrap()
+ .to_owned()
+ };
+ let (driving, driven) = (line(0.0), line(20.0));
+ h.app.run("sketch.dimension", json!({"entities":[driving],"value":30})).unwrap();
+ h.app.run("sketch.dimension", json!({"entities":[driven],"driven":true})).unwrap();
+ h.app.session.selection.clear();
+ h.call("ui.view", json!({"view":"top"}));
+ h.settle();
+ h.frames(2);
+ assert_eq!(drawn().len(), 2, "both dimensions are drawn");
+ let tk = Tokens::get();
+ let mut seen = std::collections::BTreeSet::new();
+ h.shapes.iter().for_each(|s| strokes(&s.shape, &mut seen));
+ for (name, c) in [("dimension", tk.dimension), ("dimension_driven", tk.dimension_driven)] {
+ assert!(seen.contains(&c.to_array()), "no line drawn in {name} {c:?}: {seen:?}");
+ assert_ne!(c, tk.sketch, "{name}");
+ assert_ne!(c, tk.sketch_fixed, "{name}");
+ }
+ cancel();
+ }
+
/// Typing `rad` into a new dimension's value lists `radius` although `rad` is itself the
/// radians unit; the popup is unarmed, so Down then Enter completes the name and the
/// dimension takes it (#3663).
diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs
index 90e526c5b5..1e10f907fe 100644
--- a/crates/ui-egui/src/theme.rs
+++ b/crates/ui-egui/src/theme.rs
@@ -764,7 +764,8 @@ pub struct Tokens {
pub sketch_halo: Color32,
/// Fixed (locked) sketch geometry.
pub sketch_locked: Color32,
- /// Sketch dimensions: driving, driven (reference).
+ /// Sketch dimensions: driving, driven (reference). Each theme gives them a colour of their
+ /// own, apart from the sketch curves they measure (#7861).
pub dimension: Color32,
pub dimension_driven: Color32,
/// Sketch points: fully constrained, free.