Skip to main content

hueristic

Is your palette colorblind-safe? One import to check and fix color palettes for color-vision deficiency — protanopia, deuteranopia, tritanopia.

pip install hueristic
import hueristic as hue

hue.is_safe(["#d7191c", "#1a9641"])            # False — red and green collapse under deutan/protan
hue.is_safe(["#0072b2", "#e69f00", "#009e73"]) # True  — an Okabe-Ito set stays distinct

hue.check_palette(["#d7191c", "#1a9641"])
# {'pass': False, 'types': {'deutan': {'conflicts': [{'a': '#d7191c', 'b': '#1a9641', ...}]}}}

hue.fix_palette(["#d7191c", "#1a9641"])["colors"]  # a safe palette near the originals
hue.simulate("#d7191c", "deutan")                  # how that red looks to a deuteranope

What it does

  • is_safe(colors) → True/False for the whole palette.
  • check_palette(colors) → every pair that stays distinct to normal vision but collapses under a deficiency, with the CIEDE2000 difference before and after simulation.
  • fix_palette(colors) → an adjusted palette that passes, separated along lightness, staying near the originals.
  • simulate(color, type) → the color as a given deficiency sees it.
  • check_contrast(fg, bg) → WCAG contrast ratio and AA/AAA pass.

How it decides

hueristic is a front door to opticquiz-cvd, which simulates deficiency with the Machado, Oliveira & Fernandes (2009) matrices and measures color difference with CIEDE2000. The method is published open access: https://doi.org/10.5281/zenodo.21310578

Every function here is opticquiz_cvd's, unchanged — the package adds the name and one convenience, so there is never a second copy of the colorimetry to drift.

A screening aid for the color-distinguishability axis of accessibility, not a WCAG/ADA audit, and no screen-based check is a clinical diagnosis.

Licence

MIT.

Metadata

Release files for hueristic 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hueristic 0.1.0
File Size Uploaded
hueristic-0.1.0.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hueristic 0.1.0
File Interpreter ABI Platform
hueristic-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.9 kB

Release files / hueristic-0.1.0.tar.gz

Download URL hueristic-0.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ee439ede4aec3a8aacf6164bf3c3e419b9920ccae390158ff45f0d020d553b59
BLAKE2b-256 checksum
How to use checksums
51f9fec88d160647c5d55211870afab83f8df4b97013c108fe7234bb51af8aa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Release files / hueristic-0.1.0-py3-none-any.whl

Download URL hueristic-0.1.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95d9fc3aff17d1c6bbd1a30cdf4edabd59a69ee8ea5a2eac47a6101ade677780
BLAKE2b-256 checksum
How to use checksums
61f5640b2846513d39d73b8e304f88b1403d2fd9c19c5be9c894b09c0d92a01a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page