1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SPDX-FileCopyrightText: Copyright (c) 2026 Mike Li/Mikewolfli/Wei Li(mikewolfli@163.com)
// SPDX-License-Identifier: MIT
//! Control rendering census probe (BLUE20 layer 1) — the human-facing view.
//!
//! Renders **every** control the factory publishes, twice (light and dark), and
//! prints a per-control pixel census. The same measurement is asserted by
//! `tests/control_rendering_census_test.rs`; this binary exists so a person can
//! read the raw table, and so `tools/control_rendering_baseline.txt` has a
//! reproducible producer.
//!
//! # Reading the table
//!
//! | Column | Meaning |
//! |---|---|
//! | `ink(l)` | pixels the control painted, under the light appearance |
//! | `dominant(l)` | the colour it painted most, light |
//! | `dominant(d)` | the colour it painted most, dark |
//! | `P3` | `yes` when those two differ — the control responds to the theme |
//! | `detail` | painted pixels that are not the dominant colour: text, borders |
//!
//! A control with `ink(l)=0` paints nothing at all; one with `P3=NO` renders the
//! same in both appearances, which means its chrome is hardcoded.
//!
//! # Why the factory is walked by name
//!
//! `WidgetKind` has fewer variants than the registry has controls — 13 kinds are
//! shared by 2–5 controls — so a kind sweep would silently skip 19 of them. The
//! census enumerates `WidgetFactory::widget_names`, which cannot under-count.
//!
//! # Gating
//!
//! Requires the full widget set and the theme module, i.e. the `desktop` profile.
//! Declared in `Cargo.toml` with `required-features = ["desktop"]`, so a stripped profile
//! skips the target rather than trying to link an example whose body an inner `#![cfg]`
//! removed — an inner `cfg` alone is not enough, because cargo still needs *a* `main`.
use theme_test_guard;
use ;