palette: enlarge the region title into WCAG large class; repoint the grabbed envelope handle off hue
Corrects theme.h's large-text thresholds, names accent/secondary's real binding limiter, and adds compositeOver so the loop-span fill's 2.25:1 under-floor pair is asserted rather than assumed.
This commit is contained in:
+23
-4
@@ -56,7 +56,14 @@ enum class InteractionState {
|
||||
Disabled,
|
||||
};
|
||||
|
||||
// Text size classes for the WCAG floor: "Large" (>= ~18.66px, or >= ~14px bold) and UI-state
|
||||
// WCAG 2.1's large-scale thresholds, in px at 96dpi (18pt = 24px normal, 14pt = 18.66px bold).
|
||||
// A previous revision wrote the BOLD threshold as the normal one and both ~25% low, which let
|
||||
// 15px semibold self-classify as Large and clear a floor it was not entitled to — draw sites
|
||||
// that want the Large floor static_assert their font against these.
|
||||
inline constexpr double kLargeTextMinPx = 24.0;
|
||||
inline constexpr double kLargeTextMinBoldPx = 18.66;
|
||||
|
||||
// Text size classes for the WCAG floor: "Large" (>= 24px, or >= ~18.66px BOLD) and UI-state
|
||||
// indicators clear at 3:1; body text clears at 4.5:1 (WCAG 2.1 AA).
|
||||
enum class TextClass {
|
||||
Body, // AA 4.5:1
|
||||
@@ -73,14 +80,26 @@ KitColor roleColorState(Role role, InteractionState state);
|
||||
|
||||
// Spectral hue ramp for the keyboard strip: maps normalized position t in [0, 1] (low note ->
|
||||
// high note) through a pastel lime -> teal -> purple arc, so the strip reads as part of the
|
||||
// palette rather than a separate flourish. The arc is its own three stops — a categorical
|
||||
// accent move must not be able to reorder it. t is clamped to [0, 1].
|
||||
// palette rather than a separate flourish. The MID stop is its own value; lo/hi remain aliases
|
||||
// of accent/primary and accent/tertiary, so a categorical accent move can still reorder the
|
||||
// ramp — testSpectralRampLuminanceIsMonotonic is the build-time catch, not the structure.
|
||||
// t is clamped to [0, 1].
|
||||
KitColor spectralColor(double t);
|
||||
|
||||
// --- WCAG contrast (the "punch" rule, made testable) --------------------------
|
||||
|
||||
// The effective opaque color of `over` drawn at `alpha` on top of `under` — the composition the
|
||||
// contrast math needs before it can judge a translucent fill. alpha is clamped to [0, 1]; the
|
||||
// result carries `under`'s alpha byte.
|
||||
KitColor compositeOver(const KitColor& over, const KitColor& under, double alpha);
|
||||
|
||||
// The waveform's loop-span fill alpha. Named HERE rather than at its draw site so the contrast
|
||||
// test composes the same value the shell draws with (see compositeOver).
|
||||
inline constexpr double kLoopSpanFillAlpha = 0.20;
|
||||
|
||||
// Relative luminance per WCAG 2.1 (sRGB linearization + 0.2126/0.7152/0.0722 weighting). Alpha
|
||||
// is ignored — a translucent overlay's effective color is the caller's to compose first.
|
||||
// is ignored — a translucent overlay's effective color is the caller's to compose first
|
||||
// (compositeOver).
|
||||
double relativeLuminance(const KitColor& c);
|
||||
|
||||
// WCAG contrast ratio between two colors, in [1, 21]. Symmetric.
|
||||
|
||||
Reference in New Issue
Block a user