The Monolex Tint System is implemented in both Rust (Production) and TypeScript/JavaScript (Lab/Tool). Both implementations follow the identical Gestalt Core-Flow pattern and are algorithmically equivalent.
Role: Hue compression inside the Caustic region - OkLCH Polar space operation
┌───────────────────────────────────────────────────────────────────────┐│ warp_hue_compress() ALGORITHM │├───────────────────────────────────────────────────────────────────────┤│ ││ INPUTS: hue, pull_hue, strength, width (all in radians) ││ ││ STEP 1: Early Exit ││ if width == 0 OR strength == 0 → return hue (no change) ││ ││ STEP 2: Normalize Delta to [-π, π] ││ delta = hue - pull_hue ││ while delta > π: delta -= 2π ││ while delta < -π: delta += 2π ││ ││ STEP 3: Zone Decision ││ ┌────────────────────────────────────────────────────────────────┐ ││ │ |delta| ≤ width → INSIDE ZONE (compress toward pull_hue) │ ││ │ ratio = |delta| / width │ ││ │ compressed = ratio × (1 - strength) │ ││ │ result = pull_hue + sign(delta) × compressed × width │ ││ │ │ ││ │ |delta| > width → OUTSIDE ZONE (expand away from pull_hue) │ ││ │ Redistribute remaining hue space │ ││ │ Maintain total coverage of [0, 2π] │ ││ └────────────────────────────────────────────────────────────────┘ ││ ││ OUTPUT: warped_hue (normalized to [0, 2π]) ││ │└───────────────────────────────────────────────────────────────────────┘
Both Rust and TypeScript implement this algorithm identically. The pseudocode in the diagram above describes the complete logic. Both languages use standard circular arithmetic (modular wrapping to [0, 2pi]) and handle inside/outside zones with the same compression and expansion formulas.Gestalt Core Analysis:
┌─────────────────────────────────────────────────────────────────┐│ warp_hue_compress = PURE CORE FUNCTION │├─────────────────────────────────────────────────────────────────┤│ ││ Input: hue (radian) - Polar angle ││ Output: warped_hue (radian) - Transformed Polar angle ││ ││ Operation characteristics: ││ • Operates entirely in angle (Hue) space ││ • Does not reference L, C ││ • Manipulates color identity (Hue) only ││ ││ → CORE: Polar space, identity definition ││ ││ Match: Rust === TypeScript ││ │└─────────────────────────────────────────────────────────────────┘
Both implementations use the standard Bjorn Ottosson OkLab matrices (M1 for RGB-to-LMS, M2 for LMS’-to-OkLab). These are publicly documented at bottosson.github.io/posts/oklab.
┌─────────────────────────────────────────────────────────────────┐│ IMPLEMENTATION VERIFICATION SUMMARY │├─────────────────────────────────────────────────────────────────┤│ ││ Category Status Notes ││ ──────────────────────────────────────────────────────────── ││ warp_hue_compress OK CORE function identical ││ fill_with_oklab_gradient OK FLOW function identical ││ apply_hue_warp OK Mode selection identical ││ transform_truecolor OK 7-step pipeline identical ││ OkLab conversions OK Same matrices ││ Parameter mapping OK All 20+ params mapped ││ Numeric precision OK Both exceed requirements ││ Gestalt Core-Flow OK Same pattern in both ││ ││ ═══════════════════════════════════════════════════════════ ││ ││ VERDICT: Rust === TypeScript (Functionally Identical) ││ │└─────────────────────────────────────────────────────────────────┘
The dual implementation proves that Gestalt Core-Flow is a language-independent mathematical pattern.
Connection to Core-Flow:├── CORE operations: Same Polar angle math in any language│ → atan2, cos, sin work identically everywhere├── FLOW operations: Same Cartesian lerp in any language│ → Linear algebra is universal├── Development flexibility: Experiment in JS, deploy in Rust│ → Rapid iteration without sacrificing performance└── Mathematical foundation: Not framework-dependent → Can be ported to any platform (GPU shaders, WASM, etc.)
Key Insight: Gestalt Core-Flow is the mathematical language of color manipulation. Whether implemented in Rust, TypeScript, Python, or GPU shaders, the same pattern produces the same results because it is grounded in mathematics, not implementation details.This makes the Tint System:
Portable: Same algorithm works everywhere
Verifiable: Test in JS, confident in Rust
Maintainable: Single source of truth (the math)
Extensible: Add new platforms without redesign
Back to Tint System Overview
Return to the TrueColor Tint System architecture overview