Fix Unreadable Colors in Python¶
Make your text readable for everyone.
Quick Start¶
Fix a hard-to-read color:
from cm_colors import ColorPair
# 1. Define the problem
pair = ColorPair("#777777", "#ffffff")
# 2. Get the solution
fixed_color, success = pair.make_readable()
print(fixed_color)
# Output: #757575 (Readable!)
Check your project:
# Run the linter
cc-lint lint
Installation¶
pip install cm-colors
How to use it¶
Follow these steps to ensure your colors work for everyone:
Check Locally
Run the linter in your terminal to catch issues while you work.
Automate Checks
Stop bad colors from being merged by adding a check to GitHub Actions.
Fix the Issues
When you find a problem, use our tools to fix it automatically.
How to Fix a Single Color Pair - Fix one pair in Python
How to Fix Multiple Colors at Once - Fix lists of colors
How to Fix Colors in CSS Files - Fix CSS files automatically
Deep Dive¶
What Makes CM-Colors Work - The science of preserving your design
Readability Standards & CM-Colors - Mapping “Readable” to standards