Skip to main content

cvdsim

See a color, a palette, or a whole image the way a colorblind person does. Where cvdsafe judges whether colors are safe, cvdsim shows you — it recolors a hex, or an entire PNG/JPEG, as protanopia, deuteranopia, or tritanopia renders it.

pip install cvdsim          # colors only
pip install "cvdsim[image]" # + image recoloring (Pillow, numpy)
import cvdsim as dalton

dalton.simulate("#d7191c", "deutan")   # "#8a7b0c" — that warning red, to a deuteranope
dalton.simulate_all("#1a9641")         # {"protan": "#988839", "deutan": "#8a7f48", "tritan": "#009383"}

from PIL import Image
sim = dalton.simulate_image(Image.open("dashboard.png"), "deutan")
sim.save("dashboard-deutan.png")

API

  • simulate(color, type, severity=1.0) → the color as one deficiency sees it, as hex. type is "protan", "deutan", or "tritan".
  • simulate_all(color, severity=1.0){"protan": ..., "deutan": ..., "tritan": ...}.
  • simulate_image(image, type, severity=1.0) → a recolored PIL Image (alpha preserved). image is a PIL Image or a file path. severity (0..1) shows partial deficiency (anomalous trichromacy), not only the full dichromat case.

How it works

cvdsim is a thin lens over opticquiz-cvd: every pixel's transform is that engine's simulate(), using the Machado, Oliveira & Fernandes (2009) deficiency matrices. simulate_image passes each distinct color through the engine once via a lookup table, so a photograph is not thousands of redundant calls — and there is never a second copy of the colorimetry to drift. Method, open access: https://doi.org/10.5281/zenodo.21310578

Not a clinical tool

A simulation for design and communication — it approximates how deficient color vision renders an image. It is not a diagnosis, and no on-screen rendering is exact for a given individual.

Licence

MIT.

Download files

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

Source Distribution

cvdsim-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

cvdsim-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file cvdsim-0.1.0.tar.gz.

File metadata

  • Download URL: cvdsim-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cvdsim-0.1.0.tar.gz
Algorithm Hash digest
SHA256 85f16668784edcc2ec1e1b870b923654dbb4362b57a8d7a1f6202ca41b53f21b
MD5 63b699a547534e2e5eca4f819842e08e
BLAKE2b-256 f6e3bd4ac7ff83cd10421ae61117722e5e0b246bee53ae02ae67702949f0224c

See more details on using hashes here.

File details

Details for the file cvdsim-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cvdsim-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cvdsim-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 941469af5561345e28d176cf52d6153af43ff968b697a89f46d4a40cc817cbb6
MD5 6c4e673f1a2f5414a781b07ceebf3cb6
BLAKE2b-256 4e644e3cafd57c5cdc48d2428d267a5812fb6e422126001f8e9687a1d3c8e79c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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