How sfossl/color-ergonomics works
Invariant Color Ergonomics combines a browser visualizer for interactive OKLCH color and contrast exploration with a standard-library Python simulator for analytical checks and token output. In the visualizer, user controls update application state, which resolves colors and contrast through the math module and updates the page. The simulator exposes separate command-line analyses. The excerpts show the browser’s math and content usage, but not its HTML loading order or the simulator’s command-dispatch calls; those documented simulator capabilities are therefore represented without inferred internal call edges.
Main entry points: simulator.py Simulator CLI · app.js Visualizer logic · colorMath.js Color math · content.js Interface content
Components 13
Browser visualizer
- Color controls
code/web/js/app.js - Visualizer logic
code/web/js/app.js - Interface content
code/web/config/content.js - Color math
code/web/js/colorMath.js - Rendered page
Color analysis
- Simulator CLI
code/simulator/simulator.py - OKLCH conversion
code/simulator/simulator.py - Luminance benchmarks
code/simulator/simulator.py - Gamut closure
code/simulator/simulator.py - Vision projections
code/simulator/simulator.py - CSS tokens
code/simulator/simulator.py
Other components
- Visitor
- CLI user
Connections 12
- Visitor → Color controls: changes inputs
code/web/js/app.js - Color controls → Visualizer logic: triggers render
code/web/js/app.js - Visualizer logic → Interface content: reads content
code/web/js/app.js - Visualizer logic → Color math: resolves colors
code/web/js/app.js - Visualizer logic → Color math: measures contrast
code/web/js/app.js - Visualizer logic → Rendered page: updates styles
code/web/js/app.js - CLI user → Simulator CLI: runs analysis
README.md - Simulator CLI → Luminance benchmarks: runs benchmarks
README.md - Simulator CLI → Gamut closure: checks gamut
README.md - Simulator CLI → Vision projections: projects vision
README.md - Simulator CLI → OKLCH conversion: calculates color
README.md - Simulator CLI → CSS tokens: emits CSS
README.md