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.


Installation

pip install realcolor

Quick start

  • Matplotlib
import matplotlib.pyplot as plt

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()

from realcolor import simulate_colorblindness

simulate_colorblindness(fig)

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

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

  • 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"],
)
simulated = simulate_colorblindness(fig, width=800, height=800)
simulated.show()

Other features

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

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

Matplotlib-based plots use figsize=(width, height) in inches. Plotly figures use their native width and height arguments in pixels.

  • 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.3.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.3.0
File Size Uploaded
realcolor-0.3.0.tar.gz 423.2 kB Details

Built distribution (wheel)

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

Total release size: 431.9 kB

Release files / realcolor-0.3.0.tar.gz

Download URL realcolor-0.3.0.tar.gz
Size 423.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6019f14de937879ceb0fe1dbf85bccc3c1210941e48f59b5eaf1d71ca96a5dcc
BLAKE2b-256 checksum
How to use checksums
17b228db947ab2a25ec034094da1463a20060da91afa185c71ad53b00cb134b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 21, 2026.

Transparency log

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

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

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 Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

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