CVD-safe default categorical palette#61
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
…lette Tableau10's adjacent red/green collapsed to dE 1.2 under deuteranopia and half its slots sat below the chroma floor. The new eight-slot palette keeps every step in the OKLCH lightness band shared by light and dark surfaces (L 0.48-0.67) and passes the validator on both reference surfaces: worst adjacent-pair CVD dE 8.5 (>=8 target), worst adjacent normal-vision dE 19.1 (>=15 floor), all slots >=3:1 contrast. Slot order is the safety mechanism (adjacency drives the dE gate), so the palette must be re-validated before any re-order or extension. Updates the hardcoded segment colors in the Reflex demo app and the visual-regression chrome shell.
b605467 to
5701f77
Compare
|
Reviewed — the palette itself is solid, but the committed demo assets don't match the PR description and actively mislabel colors. Blocking: the regenerated The PR body says these assets were regenerated, but the diff only touches 3 files and the committed assets still embed the old Tableau10 colors — Fix: run Non-blocking:
The palette design itself checks out — I independently reproduced the CVD claims (Machado protan/deutan simulation + Lab ΔE76): the old palette does collapse ( |
|
Assets were removed to make it easy to review the pr. |
Alek99
left a comment
There was a problem hiding this comment.
Review findings:
- [P2]
python/xy/config.py:70: reducing the default palette to eight makes categories/traces 1 and 9 identical because color assignment cycles modulo palette length. Preserve at least ten distinct defaults or warn/guard above eight categories. - [P2]
examples/reflex/reflex_xy_app/reflex_xy_app.py:41: the custom legend uses the new palette, but the committedassets/charts/custom_chrome.htmlstill embeds the old palette. Regenerate and commit the asset.
Greptile SummaryThis PR replaces the default categorical colors with a CVD-safe palette. The main changes are:
Confidence Score: 5/5This looks safe to merge. No blocking issues found in the changed code.
What T-Rex did
Important Files Changed
Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
…resh stale demo assets Color assignment cycles modulo the palette, so with eight slots the ninth default-colored trace or category silently wore slot one's color. The palette stays eight slots by design (the adjacency order is the validated CVD-safety mechanism and cannot grow a ninth hue without re-clearing the validator), so the wrap now warns instead of aliasing silently (§28): default_palette_color() guards every trace-default site, and categorical resolve warns when categories exceed the default palette. Also regenerates the two committed Reflex demo assets that still embedded Tableau10 colors from before the palette swap (custom_chrome.html's category palette and density_scatter.html's trace color).
# Conflicts: # examples/reflex/assets/charts/custom_chrome.html # examples/reflex/assets/charts/density_scatter.html # examples/reflex/reflex_xy_app/reflex_xy_app.py # python/xy/marks.py # scripts/visual_regression_smoke.py
Summary
Replaces the Tableau10 default categorical palette with an eight-slot CVD-safe palette (§20/§36 default theme).
Why: Tableau10's adjacent red/green pair collapsed to ΔE 1.2 under deuteranopia — effectively indistinguishable — and slots 1/5/7/9/10 sat below the chroma floor.
The new palette keeps every step in the OKLCH lightness band shared by light and dark surfaces (L 0.48–0.67) and validates against both reference surfaces (
#fcfcfb/#1a1a19):The slot order is the safety mechanism — adjacency drives the ΔE gate — so the config comment now warns against re-ordering or extending without re-running the validator.
Also in this PR
examples/reflex/assets/charts/*.html, which also picks up the current embedded render client (colormap stops, colorbar chrome CSS) from recent main commits.Checks
pre-commit run --all-files,ruff check,ruff format --checkall pass.