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.

Metadata

Release files for cvdsim 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 cvdsim 0.1.0
File Size Uploaded Provenance
cvdsim-0.1.0.tar.gz 4.5 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 9.3 kB

Release files / cvdsim-0.1.0.tar.gz

Download URL cvdsim-0.1.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
85f16668784edcc2ec1e1b870b923654dbb4362b57a8d7a1f6202ca41b53f21b
BLAKE2b-256 checksum
How to use checksums
f6e3bd4ac7ff83cd10421ae61117722e5e0b246bee53ae02ae67702949f0224c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL cvdsim-0.1.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
941469af5561345e28d176cf52d6153af43ff968b697a89f46d4a40cc817cbb6
BLAKE2b-256 checksum
How to use checksums
4e644e3cafd57c5cdc48d2428d267a5812fb6e422126001f8e9687a1d3c8e79c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for cvdsim 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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