Skip to main content

realcolor: simulate colorblindness in Python charts

realcolor is a lightweight Python package designed to show how colorblind people see your graphs. It simulates all types of colorblindness (deuteranopia, protanopia, tritanopia).

It works with the following library: matplotlib, seaborn, plotnine and plotly, and all the way between Python 3.10 and 3.15.


Installation

pip install realcolor

Quick start

  • Matplotlib
import matplotlib.pyplot as plt
from realcolor import simulate_colorblindness

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 2, 5], label="Group A", lw=4)
ax.plot([1, 2, 3], [2, 5, 3], label="Group B", lw=4)
ax.legend()

simulate_colorblindness(fig)

Matplotlib line charts simulated for deuteranopia, protanopia, tritanopia, and desaturation

  • Plotnine
from plotnine import ggplot, geom_point, aes
from plotnine.data import anscombe_quartet
from realcolor import simulate_colorblindness

gg = ggplot(anscombe_quartet, aes(x="x", y="y", color="dataset")) + geom_point(size=10)

simulate_colorblindness(gg)

Plotnine scatter plots simulated for deuteranopia, protanopia, tritanopia, and desaturation

  • Plotly
import plotly.express as px
from realcolor import simulate_colorblindness

fig = px.scatter(
    x=[1, 2, 3, 4],
    y=[4, 2, 5, 3],
    color=["Group A", "Group A", "Group B", "Group B"],
)

simulate_colorblindness(fig)

Plotly scatter plots simulated for deuteranopia, protanopia, tritanopia, and desaturation


Other features

  • Simulate just one kind of colorblindness (one of "deuteranopia", "protanopia", "tritanopia", "desaturated"):
simulate_colorblindness(fig, kind="protanopia")

Two-group line chart simulated for protanopia

  • Control the severity of the simulation (between 0 to 100, default to 100):
simulate_colorblindness(fig, kind="protanopia", severity=50)

Two-group line chart simulated for protanopia at reduced severity

  • Score how colorblind-friendly a set of colors is (0 = indistinguishable, 100 = perfectly distinguishable):
from realcolor import colorblind_score

score = colorblind_score(["red", "green", "blue"])

score.overall
# > 52.1

score.deuteranopia
# > {"score": 66.7, "min_deltaE": 16.7, "worst_pair": ("#ff0000", "#008000")}

Contributing

  • Fork the repository to your own GitHub account.

  • Clone your forked repository to your local machine (ensure you have Git installed):

git clone https://github.com/YOUR_NAME/realcolor.git
cd realcolor
  • Create a new branch:
git checkout -b my-feature
  • Set up your Python environment (ensure you have uv installed):
uv sync --all-extras --dev
uv run pre-commit install
uv pip install -e .
  • Test that everything works correctly by running:
uv run pytest


  1. Deane B. Judd, "Facts of Color-Blindness*," J. Opt. Soc. Am. 33, 294-307 (1943) ↩

Metadata

Release files for realcolor 0.4.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 realcolor 0.4.0
File Size Uploaded Provenance Actions
realcolor-0.4.0.tar.gz 437.7 kB With provenance Details for realcolor-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 446.4 kB

Release files / realcolor-0.4.0.tar.gz

Download URL realcolor-0.4.0.tar.gz
Size 437.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e9306e3d47d871c43664a0d62b2641faf7abc906cd692bf2f58864f7cd5675bf
BLAKE2b-256 checksum
How to use checksums
aef97982b3e99b54dc436f13b3b2fd0c64daaa80af637ff5ec73560ddc520a1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / realcolor-0.4.0-py3-none-any.whl

Download URL realcolor-0.4.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb766c43d0736aad0ba7c0a147e07c739a7e019b982f6b04b84ac57590b8db83
BLAKE2b-256 checksum
How to use checksums
b5594a002df0ffade2f4fbc8d310f083433546beb876b741f77b783f63d64228
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for realcolor 0.4.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for realcolor-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

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.

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