Skip to main content

Check color palettes for colorblind-safety (protan/deutan/tritan, Machado 2009 + CIEDE2000). Zero dependencies; drops into any matplotlib/plotly workflow.

Project description

opticquiz-cvd (Python)

Is your chart colorblind-safe? Red-green color-vision deficiency affects ~1 in 12 men — and the classic failure is a plot where the red series and the green series look identical to those readers. This checks any palette for that, with zero dependencies, and drops straight into a matplotlib / plotly / seaborn workflow.

It simulates protanopia, deuteranopia and tritanopia (Machado, Oliveira & Fernandes, 2009) and scores perceptual difference with CIEDE2000, flagging pairs that are clearly distinct to normal vision but collapse under a color-vision-deficiency simulation.

Method (citable): https://doi.org/10.5281/zenodo.21310578

Install

pip install opticquiz-cvd

Use it on a chart palette

import opticquiz_cvd as cvd

report = cvd.check_palette(["#d7191c", "#1a9641", "#2166ac"])
report["pass"]                         # False
report["types"]["deutan"]["conflicts"]
# [{'a': '#d7191c', 'b': '#1a9641', 'normal': 70.6, 'sim': 8.1, 'severity': 'risk'}]

Works directly with matplotlib colors (hex, names, or 0-1 RGB tuples):

import matplotlib.pyplot as plt, opticquiz_cvd as cvd
cycle = plt.rcParams["axes.prop_cycle"].by_key()["color"]
print("colorblind-safe:", cvd.check_palette(cycle)["pass"])

cvd.simulate((0.84, 0.10, 0.11), "deutan")   # '#8a7b0c'  (how a deuteranope sees it)
cvd.delta_e("#d7191c", "#1a9641")            # 70.6

Command line:

python -m opticquiz_cvd "#d7191c" "#1a9641" "#2166ac"
# FAIL - color conflicts found (3 colors)
#   deutan: #d7191c/#1a9641 dE8.1(risk)

Honest scope

Simulates a model of color-vision deficiency — an approximation of a diverse population, not any single person's vision — and results depend on an uncalibrated screen. It reliably catches classic red-green and blue-yellow conflicts. It is not a legal accessibility audit and does not certify ADA / Section 508 / WCAG / EU Accessibility Act compliance.

License

MIT. Method: Machado, Oliveira & Fernandes (2009) + CIEDE2000. Part of OpticQuiz.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opticquiz_cvd-1.0.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opticquiz_cvd-1.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file opticquiz_cvd-1.0.0.tar.gz.

File metadata

  • Download URL: opticquiz_cvd-1.0.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for opticquiz_cvd-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2230fc6722df5e7e352f2c6a43c5f1848fa982ea477cc5d1dcaa68a4542d403b
MD5 4ee7167caf5ebd863f6194a755c8fd16
BLAKE2b-256 f2f2ff76812d7d58ce5791e68585dc22372876d27c4a30e5f2312cefdbe2fc56

See more details on using hashes here.

File details

Details for the file opticquiz_cvd-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: opticquiz_cvd-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for opticquiz_cvd-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3ba964b2c5cccfb5749cbca78ffb28c2d8b460d73b4edeca4180678d8dc6bc1
MD5 37c9d96f6613c80bd1e69297085ff37f
BLAKE2b-256 e00bf13252cfe268cd5dcc79e2c04039879aacd6b3a8a7acf67257b6c184080f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page