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:

  1. Check Locally

    Run the linter in your terminal to catch issues while you work.

  2. Automate Checks

    Stop bad colors from being merged by adding a check to GitHub Actions.

  3. Fix the Issues

    When you find a problem, use our tools to fix it automatically.

Deep Dive