Skip to main content

CM-Colors 🎨✨

Python Tests PyPI - Version PyPI DownloadsLicense

Color contrast that works for everyone

CM-Colors automatically fixes your colors so they are easy to read. It finds similar colors that work for everyone, so you don't have to guess.

"Fortunately, there's a tool that's just come out that's going to change your life: CM-Colors. You give it your colors, and it automatically adjusts them so they're accessible, all while changing the shades as little as possible to keep your design intact."

— Korben.info

The percentage shows how much easier the text is to read:

an image showing side by side comparision of before and after change of colors

Overview

Spending too much time adjusting colors? CM-Colors handles it for you. It automatically finds colors that look like your brand but are readable for all your visitors.

What it does:

  • Fixes colors automatically: No more manual tweaking.
  • Works everywhere: Fix Python code or CSS files.
  • Keeps your style: Changes colors as little as possible.
  • Saves you time: Fix your whole project in seconds.

Installation

pip install cm-colors

Quick Start

Fix a single color

from cm_colors import ColorPair

# Your colors
pair = ColorPair("#999999", "#ffffff")

# Fix them and preview in the terminal
fixed_color, success = pair.make_readable(show=True)

print(f"Use {fixed_color} instead of #999999")
# Output: Use #8e8e8e instead of #999999

Fix many colors at once

from cm_colors import make_readable_bulk

my_colors = [
    ("#777", "#fff"),
    ("#888", "#000"),
]

results = make_readable_bulk(my_colors)

for color, status in results:
    print(f"{color} is {status}")

Fix CSS files

Run this in your terminal to fix all colors in a CSS file:

cm-colors styles.css

This creates styles_cm.css with readable colors which you can preview before you modify your original css

Documentation

For more details, see the full documentation.

License

GNU General Public License v3.0

Support

Found a problem? Let us know.


Stop guessing, start building.

Metadata

Release files for cm-colors 1.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 cm-colors 1.1.0
File Size Uploaded
cm_colors-1.1.0.tar.gz 42.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cm-colors 1.1.0
File Interpreter ABI Platform
cm_colors-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 93.9 kB

Release files / cm_colors-1.1.0.tar.gz

Download URL cm_colors-1.1.0.tar.gz
Size 42.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b22cce5e9523edce5222c14a74ba35408997c60944f71710ea891e3bb1d8aefb
BLAKE2b-256 checksum
How to use checksums
f5a7a9537d175c8e8a24d3ee183afbf08d31fd9c4efa22bf1a3e8de92f9a1378
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / cm_colors-1.1.0-py3-none-any.whl

Download URL cm_colors-1.1.0-py3-none-any.whl
Size 51.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
036ae0e110a0303318afd284264e8e469b0a389dc08a07b944e683608bf0e9d5
BLAKE2b-256 checksum
How to use checksums
a3197d2fc84864eae2ba39475250d4addc5e2b9a06b567ac29af880afd305922
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

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