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."
The percentage shows how much easier the text is to read:
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.
pip install cm-colorsfrom 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 #999999from 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}")# check a pair
cm-colors contrast '#777777' '#ffffff' --json
# fix a pair
cm-colors fix '#777777' '#ffffff' --json
# fix a CSS file
cm-colors fix styles.csscm-colors fix styles.css creates styles_cm.css with readable colors so you can preview before touching your original.
For more details, see the full documentation.
The optimization algorithm is described in two peer-reviewed papers:
-
Context-Adaptive Color Optimization for Web Accessibility (arXiv:2512.07623) — context-adaptive constraint strategies achieving 93.68% success across random color pairs and 100% on pairs with initial contrast ratio > 2.0, tested on 10,000 programmatically generated branding-representative pairs.
-
Perceptually-Minimal Color Optimization for Web Accessibility (arXiv:2512.05067) — the multi-phase OKLCH optimization approach that minimizes perceptual change (CIEDE2000) while meeting WCAG contrast requirements.
GNU General Public License v3.0
Found a problem? Let us know.
Stop guessing, start building.