The Algebra of Color Design
Context: The physics and grammar of the color system.1
This document defines the “Physics” of the color system. It replaces the previous static heuristic model with a Reactive Physics Model based on continuous state interpolation.
1. The State Space ()
Section titled “1. The State Space (Σ\Sigma)”Definition 1 (State Configuration ). The system configuration is a 5-tuple where:
- Atmosphere (): The environmental vector .
- : Hue. The base angle of the environment.
- : Vibrancy Coefficient. A scalar multiplier acting on the maximum potential chroma () of the environment.
- Voice (): The semantic intent.
- Let be the set of pre-solved lightness constants derived by the lighting function (see Section 2.1).
- : A reference to a specific semantic intent (e.g., High Contrast).
- Time (): The normalized temporal parameter.
- : Represents the shift from Night () to Day ().
- Gain (): The user’s contrast preference.
- . Amplifies the Voice () target contrast. Used for High Contrast Mode.
- Mode (): The rendering technique.
- :
- 0: Rich Mode (Standard).
- 1: X-Ray Mode (Forced Colors).2
- :
2. The Architecture: Static Initialization vs. Runtime Algebra
Section titled “2. The Architecture: Static Initialization vs. Runtime Algebra”The system is explicitly split into two domains to guarantee performance and correctness.
2.1. Pre-Computation Routine (Static Phase)
Section titled “2.1. Pre-Computation Routine (Static Phase)”The initialization routine3 solves the “Hard Math” (APCA Contrast) offline. It calculates the exact Lightness () required for a specific Voice () to be legible against a specific background.
It also applies a Helmholtz-Kohlrausch Buffer to offset the perceptual lightness of vibrant colors.
These constants are baked into the CSS as variables (e.g., --text-high-L: 98%).
2.2. Algebra (Render Time)
Section titled “2.2. Algebra (Render Time)”The Algebra (CSS Engine)4 is a “Switching Mixer.” It resolves the final color based on the System Mode ().
3. The Operators
Section titled “3. The Operators”Classes in the system are Operators that transform the state .
3.1. The Surface Split
Section titled “3.1. The Surface Split”We distinguish between two topological types of surfaces.
3.1.1. Glass Surfaces ()
Section titled “3.1.1. Glass Surfaces (SglassS_{\text{glass}})”Glass surfaces are Filters. They inherit the Atmosphere () from their parent but apply Bicone Dampening to ensure the background remains a subtle tint, safe for text.
3.1.2. Solid Surfaces ()
Section titled “3.1.2. Solid Surfaces (SsolidS_{\text{solid}})”Solid surfaces are Emitters. They represent “pre-calculated pairs” (like Primary Buttons) where the color is derived at build-time to be maximal. They do not dampen. They establish a new Atmosphere.
4. The Universal Safety Theorem (Adaptive Clamping)
Section titled “4. The Universal Safety Theorem (Adaptive Clamping)”To guarantee that text is always readable on Glass Surfaces in Rich Mode, we enforce the Universal Safety Theorem. The Chroma () of any Glass Surface is mathematically constrained to lie within the Safe Bicone.
4.1. The Vibrancy Limit ()
Section titled “4.1. The Vibrancy Limit (ClimitC_{\text{limit}})”The maximum allowed Chroma is the intersection of three functions:
-
The Sine Wave (): The hue-dependent boundary.
-
The Bicone Taper (): The lightness-dependent boundary. Defined as a Linear Taper (Absolute Value).
-
The Tunnel (): The motion-dependent boundary. Defined as a Parabolic Ease function.
4.2. The Dampening Function
Section titled “4.2. The Dampening Function”For Glass Surfaces, the resolved Chroma is the minimum of the requested Vibrancy and the Limit.
5. The Hollow State (X-Ray Mode)
Section titled “5. The Hollow State (X-Ray Mode)”When (Forced Colors), the system enters X-Ray Mode.
- Physics is Disabled: The Bicone/Tunnel math is skipped.
- Topology is Transformed: Surfaces are no longer defined by Area (Background Color) but by Boundary (Border).
This ensures that the semantic structure of the UI is preserved even when the operating system strips all background colors.
6. Summary
Section titled “6. Summary”- State is Unified: .
- Safety is Geometric: The Safe Bicone ensures text legibility by clamping Chroma linearly.
- Mode is Topological: Rich Mode paints pixels; X-Ray Mode draws lines (The Hollow State).
- Execution is Split: The initialization routine solves the goals; Algebra enforces the constraints.