Show the colour mixer as three runs of twelve, each row a colour
Build and test / Desktop (Linux) (push) Successful in 17m20s
Build and test / Layer separation (push) Successful in 33s
🐳 Android image / Build and push (push) Successful in 2s
Build and test / android-image (push) Successful in 2s
Traceability / Requirement traces (push) Failing after 26s
Build and test / Android (aarch64) (push) Failing after 8m59s

The mixer was thirty-six sliders reading "Hue / Sat / Lum" twelve times
over with nothing saying which band any row belonged to. The identity was
there all along — the descriptor declares param.mixer.orange.sat and BANDS
carries orange at 30° — and was discarded on the way out: labels.rs had no
mixer entries, so every key fell through to a derived label that yields the
bare channel name.

A parameter can now say which aspect it adjusts and which subject it
adjusts it on, with the subject's hue where the subject is a colour
(descriptor::Facet). That is data about what the operation does, not a
layout: the mixer genuinely weights pixels around 30°. What to draw from
30°, and in what order to stack the runs, stay in dr-ui (ARCH §4.3a) —
develop.rs brings rows sharing an aspect together and marks the first of
each, and adjust.slint names the run once and draws a swatch, a track and a
readout on one line.

Grouped by channel rather than by band because an edit is almost never
"everything about orange"; it is the saturation of the greens, made by
comparing one channel across neighbouring bands. Twelve band sections put
those twelve rows in twelve different places.

The swatch is the label, which is what makes twelve rows fit where four
did. The band name is not lost: it is the row's accessible label, so the
control is not colour-only, and labels.rs is where the mapping is written
down — including chartreuse as "Yellow-Green" and spring as "Blue-Green",
since nobody hunting foliage scans a list for "Spring".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-16 16:14:13 +02:00
co-authored by Claude Opus 5
parent ab4a7e00e7
commit 9b2ee0d0eb
10 changed files with 653 additions and 44 deletions
+92 -17
View File
@@ -21,7 +21,7 @@
//! setting every band's saturation to +100 gives the same result as setting
//! the global saturation to +100 rather than something far stronger.
use crate::descriptor::{LocalizedKey, OpDescriptor, OpId, ParamDescriptor, ParamId};
use crate::descriptor::{Facet, LocalizedKey, OpDescriptor, OpId, ParamDescriptor, ParamId};
use crate::operation::{Helper, Operation, Uniform};
use crate::ops::helpers;
@@ -114,43 +114,72 @@ impl Channel {
// Parameter descriptors, one per band per channel. Written out rather than
// generated because `ParamDescriptor` must be `const` to live in a `static`,
// and a const loop cannot build a slice. The macro keeps it honest.
//
// **Every one of them is faceted**, and that is what makes the operation
// legible in a panel. Thirty-six parameters presented as a flat list are
// thirty-six sliders reading "Hue / Sat / Lum" twelve times with nothing
// saying which band any row belongs to — the identity is right here in the
// descriptor and used to be discarded on the way out. The facet carries it:
// the channel as the aspect, the band as the subject, and the band's centre
// hue so a frontend can identify the row by the colour it edits rather than
// by a word. What a frontend *does* with 30° is its own business (ARCH
// §4.3a); this only says the parameter acts on the band centred there.
macro_rules! band_params {
($($key:literal),* $(,)?) => {
($(($key:literal, $hue:literal)),* $(,)?) => {
&[
$(
ParamDescriptor::amount(
concat!($key, "_hue"),
concat!("param.mixer.", $key, ".hue"),
),
)
.faceted(Facet {
aspect: LocalizedKey("param.channel.hue"),
subject: LocalizedKey(concat!("band.", $key)),
subject_hue: Some($hue),
}),
ParamDescriptor::amount(
concat!($key, "_sat"),
concat!("param.mixer.", $key, ".sat"),
),
)
.faceted(Facet {
aspect: LocalizedKey("param.channel.sat"),
subject: LocalizedKey(concat!("band.", $key)),
subject_hue: Some($hue),
}),
ParamDescriptor::amount(
concat!($key, "_lum"),
concat!("param.mixer.", $key, ".lum"),
),
)
.faceted(Facet {
aspect: LocalizedKey("param.channel.lum"),
subject: LocalizedKey(concat!("band.", $key)),
subject_hue: Some($hue),
}),
)*
]
};
}
// A fourth table parallel to `BANDS` and the three uniform-name tables, for
// the same reason as those: `concat!` needs literals, so the keys and hues
// cannot be read out of `BANDS` here. `facets_match_their_bands` below is
// what keeps them from drifting.
static DESCRIPTOR: OpDescriptor = OpDescriptor {
id: ID,
label: LocalizedKey("op.colour_mixer"),
params: band_params![
"red",
"orange",
"yellow",
"chartreuse",
"green",
"spring",
"cyan",
"azure",
"blue",
"violet",
"magenta",
"rose",
("red", 0.0),
("orange", 30.0),
("yellow", 60.0),
("chartreuse", 90.0),
("green", 120.0),
("spring", 150.0),
("cyan", 180.0),
("azure", 210.0),
("blue", 240.0),
("violet", 270.0),
("magenta", 300.0),
("rose", 330.0),
],
};
@@ -501,6 +530,52 @@ mod tests {
}
}
#[test]
fn facets_match_their_bands() {
// The macro's `(key, hue)` list is a fourth table parallel to `BANDS`,
// and a hue mistyped there would put a row's swatch on a colour the
// band does not act on — a control that lies about what it edits,
// which is worse than one with no swatch at all.
for p in DESCRIPTOR.params {
let facet = p.facet.expect("every mixer parameter is faceted");
let (band_key, _) = p.id.0.rsplit_once('_').expect("id is band_channel");
let band = BANDS
.iter()
.find(|b| b.key == band_key)
.expect("the id names a band");
assert_eq!(
facet.subject.0,
format!("band.{band_key}"),
"{} is subject to the wrong band",
p.id
);
assert_eq!(
facet.subject_hue,
Some(band.hue),
"{} claims a hue its band does not have",
p.id
);
}
}
#[test]
fn each_channel_is_one_aspect_across_every_band() {
// What lets a panel name the run once instead of twelve times: the
// twelve hue parameters must agree they are the same control. Were
// the aspect keyed per band, grouping by it would produce thirty-six
// groups of one and nothing would have been gained.
let mut per_aspect = std::collections::BTreeMap::new();
for p in DESCRIPTOR.params {
let facet = p.facet.expect("faceted");
*per_aspect.entry(facet.aspect.0).or_insert(0) += 1;
}
assert_eq!(per_aspect.len(), Channel::ALL.len());
for (aspect, count) in per_aspect {
assert_eq!(count, BANDS.len(), "{aspect} does not cover every band");
}
}
#[test]
fn a_fresh_mixer_is_inactive() {
assert!(!ColourMixer::new().is_active());