KU
KurtWeston/color-extract
Extract color palettes from images and generate CSS variables, Tailwind configs, or design tokens
color-extract
Extract color palettes from images and generate CSS variables, Tailwind configs, or design tokens
Features
- Extract N dominant colors from images using k-means clustering
- Support common image formats (PNG, JPG, GIF, WebP)
- Generate CSS custom properties (--color-1, --color-2, etc.)
- Generate Tailwind CSS color configuration object
- Generate JSON design tokens with color names and hex values
- Generate SCSS variables ($color-1, $color-2, etc.)
- Calculate WCAG contrast ratios between extracted colors
- Suggest accessible color pairings for text/background
- Generate complementary colors using color theory
- Batch process multiple images and output combined palette
- Sort colors by hue, saturation, or brightness
- Option to exclude similar colors (minimum distance threshold)
- Display color preview in terminal using ANSI colors
- Output color percentages (how much of image each color represents)
How to Use
Use this project when you need to:
- Quickly solve problems related to color-extract
- Integrate python functionality into your workflow
- Learn how python handles common patterns
Installation
# Clone the repository
git clone https://github.com/KurtWeston/color-extract.git
cd color-extract
# Install dependencies
pip install -r requirements.txtUsage
python main.pyBuilt With
- python
Dependencies
pillownumpyscikit-learnclick
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
On this page
Languages
Python100.0%
Contributors
Latest Release
v1.0.0March 9, 2026MIT License
Created March 9, 2026
Updated March 9, 2026