feat(a11y): add Theme.is-high-contrast flag to gate HC-only borders
P4 foundation for the redundant-encoding accessibility pass. Adds a single flag that High-Contrast-only affordances (1px control borders, slider-thumb borders) read so they never leak into the polished normal themes, mirroring the existing is-system wiring. - qbz-theme: `pub fn is_high_contrast(id)` at the crate root next to `is_light` (true for HighContrast + HighContrastLight), with a unit test `high_contrast_flag_only_for_hc_themes` asserting exactly the two HC themes. - qbz-slint theme.slint: `in-out property <bool> is-high-contrast: false;` beside is-system; re-exported via semantic-colors.slint so all ~145 components get `Theme.is-high-contrast` with no per-file import change. Embedded the canonical HC border gate and the non-layout focus-ring snippet as a comment for the cluster agents to copy verbatim. - qbz-slint theme.rs: apply_theme sets it via `qbz_theme::is_high_contrast(id)`. cc
This commit is contained in:
3 files changed
+45
No files matched your search
@@ -151,6 +151,26 @@ export global Theme {
|
||||
// std-Palette fallback for the System-overridden tokens below.
|
||||
in-out property <bool> is-system: false;
|
||||
|
||||
// True only for the two High-Contrast themes (HighContrast/HighContrastLight).
|
||||
// Set by Rust alongside `c`. Gates HC-ONLY redundant-encoding affordances
|
||||
// (1px control borders, slider-thumb borders) so they never leak into the
|
||||
// polished normal themes. Components read it via the re-exported Theme global.
|
||||
//
|
||||
// Canonical HC border gate (copy verbatim in components):
|
||||
// border-width: Theme.is-high-contrast ? 1px : 0px;
|
||||
// border-color: Theme.border-strong;
|
||||
//
|
||||
// Canonical NON-LAYOUT focus ring (copy verbatim; draw as a sibling/overlay
|
||||
// Rectangle so focus never reflows the control):
|
||||
// Rectangle {
|
||||
// x: 0; y: 0; width: parent.width; height: parent.height;
|
||||
// border-width: 2px;
|
||||
// border-color: root.has-focus ? Theme.focus-ring : transparent;
|
||||
// border-radius: parent.border-radius;
|
||||
// background: transparent;
|
||||
// }
|
||||
in-out property <bool> is-high-contrast: false;
|
||||
|
||||
// --- Surfaces: System follows the OS palette (was `mode == 3`) -----------
|
||||
out property <color> surface-main: is-system ? StdPalette.background : c.surface-main;
|
||||
out property <color> surface-card: is-system ? StdPalette.alternate-background : c.surface-card;
|
||||
|
||||
Reference in new issue
Block a user