🟢 Problem
TrustLens ships a centralized styling system in trustlens/visualization/style.py built around a Theme dataclass. The module docstring explicitly states that the architecture exists so that "future themes (dark, colorblind, publication) can be added by registering a new Theme instance without touching plotting code."
The infrastructure is fully built — but no alternative themes exist yet. The default palette uses red/green distinctions (e.g., severity colors: green = acceptable, red = severe) that are indistinguishable to the ~8% of users with red-green color blindness (deuteranopia/protanopia).
This means a meaningful portion of TrustLens users are currently seeing ambiguous diagnostic output.
🎯 Expected Outcome
A new COLORBLIND_THEME exported from trustlens/visualization/style.py, usable like this:
from trustlens.visualization.style import COLORBLIND_THEME
report.summary_plot(theme=COLORBLIND_THEME)
The colorblind theme replaces the red/green severity pair with a blue/orange pair — the most reliable combination for all common forms of color vision deficiency (per the Wong 2011 palette, widely used in scientific publishing).
🧩 Where to Edit
| File |
Change |
trustlens/visualization/style.py |
Add COLORBLIND_THEME constant |
tests/test_visualization_style.py |
Add tests for the new theme |
docs/ |
Document the theme in the visualization guide |
⚡ Proposed Steps
1. Open trustlens/visualization/style.py.
2. Define a new color palette based on the Wong (2011) colorblind-safe palette. The seven colors are: #0072B2 (blue), #E69F00 (orange), #009E73 (teal), #CC79A7 (pink), #56B4E9 (sky blue), #D55E00 (vermillion), #F0E442 (yellow).
3. Create a COLORBLIND_THEME by instantiating Theme(...) with overridden palette and semantic colors. The semantic["severity"] mapping is the most important to fix:
acceptable → blue (#0072B2) instead of green
severe → vermillion (#D55E00) instead of red
moderate → orange (#E69F00) — same role, different hue
4. Export COLORBLIND_THEME at module level alongside DEFAULT_THEME.
5. Write tests in tests/test_visualization_style.py:
test_colorblind_theme_is_theme_instance — COLORBLIND_THEME is a Theme
test_colorblind_theme_has_no_pure_red — #FF3B30 and #34C759 (default red/green) do not appear in the colorblind theme's semantic colors
test_colorblind_theme_palette_length — palette has at least 7 colors
test_apply_style_accepts_colorblind_theme — with apply_style(COLORBLIND_THEME) as theme: does not raise
6. Add a one-paragraph note in docs/ (wherever visualization is documented) explaining when and how to use the colorblind theme.
🧪 How to Verify
pytest tests/test_visualization_style.py -v -k "colorblind"
Smoke test:
from trustlens.visualization.style import COLORBLIND_THEME, apply_style
import matplotlib.pyplot as plt
with apply_style(COLORBLIND_THEME) as theme:
print(theme.semantic["severity"])
# Should show blue/orange/teal — not red/green
🤝 Need Help?
Comment on this issue or join our Discussions.
Difficulty: 🟢 Beginner — No ML knowledge needed. Pure Python dictionary work. The Theme dataclass is already built; this issue is about filling in the right color values. The Wong (2011) palette is a widely cited standard — the colors are provided in the implementation notes below, no color theory research needed.
Reference: Wong, B. (2011). Color blindness. Nature Methods, 8(6), 441. The seven-color palette: #E69F00, #56B4E9, #009E73, #F0E442, #0072B2, #D55E00, #CC79A7.
PR checklist:
🟢 Problem
TrustLens ships a centralized styling system in
trustlens/visualization/style.pybuilt around aThemedataclass. The module docstring explicitly states that the architecture exists so that "future themes (dark, colorblind, publication) can be added by registering a newThemeinstance without touching plotting code."The infrastructure is fully built — but no alternative themes exist yet. The default palette uses red/green distinctions (e.g., severity colors:
green= acceptable,red= severe) that are indistinguishable to the ~8% of users with red-green color blindness (deuteranopia/protanopia).This means a meaningful portion of TrustLens users are currently seeing ambiguous diagnostic output.
🎯 Expected Outcome
A new
COLORBLIND_THEMEexported fromtrustlens/visualization/style.py, usable like this:The colorblind theme replaces the red/green severity pair with a blue/orange pair — the most reliable combination for all common forms of color vision deficiency (per the Wong 2011 palette, widely used in scientific publishing).
🧩 Where to Edit
trustlens/visualization/style.pyCOLORBLIND_THEMEconstanttests/test_visualization_style.pydocs/⚡ Proposed Steps
1. Open
trustlens/visualization/style.py.2. Define a new color palette based on the Wong (2011) colorblind-safe palette. The seven colors are:
#0072B2(blue),#E69F00(orange),#009E73(teal),#CC79A7(pink),#56B4E9(sky blue),#D55E00(vermillion),#F0E442(yellow).3. Create a
COLORBLIND_THEMEby instantiatingTheme(...)with overriddenpaletteandsemanticcolors. Thesemantic["severity"]mapping is the most important to fix:acceptable→ blue (#0072B2) instead of greensevere→ vermillion (#D55E00) instead of redmoderate→ orange (#E69F00) — same role, different hue4. Export
COLORBLIND_THEMEat module level alongsideDEFAULT_THEME.5. Write tests in
tests/test_visualization_style.py:test_colorblind_theme_is_theme_instance—COLORBLIND_THEMEis aThemetest_colorblind_theme_has_no_pure_red—#FF3B30and#34C759(default red/green) do not appear in the colorblind theme's semantic colorstest_colorblind_theme_palette_length— palette has at least 7 colorstest_apply_style_accepts_colorblind_theme—with apply_style(COLORBLIND_THEME) as theme:does not raise6. Add a one-paragraph note in
docs/(wherever visualization is documented) explaining when and how to use the colorblind theme.🧪 How to Verify
pytest tests/test_visualization_style.py -v -k "colorblind"Smoke test:
🤝 Need Help?
Comment on this issue or join our Discussions.
Difficulty: 🟢 Beginner — No ML knowledge needed. Pure Python dictionary work. The
Themedataclass is already built; this issue is about filling in the right color values. The Wong (2011) palette is a widely cited standard — the colors are provided in the implementation notes below, no color theory research needed.Reference: Wong, B. (2011). Color blindness. Nature Methods, 8(6), 441. The seven-color palette:
#E69F00,#56B4E9,#009E73,#F0E442,#0072B2,#D55E00,#CC79A7.PR checklist:
COLORBLIND_THEMEdefined and exported instyle.pytests/test_visualization_style.pyCHANGELOG.mdupdated under[Unreleased]