color-palette-extractor
npx machina-cli add skill dkyazzentwatwa/chatgpt-skills/color-palette-extractor --openclawFiles (1)
SKILL.md
1.5 KB
Color Palette Extractor
Extract dominant colors from images and generate color palettes with multiple export formats.
Features
- Dominant Colors: Extract N most dominant colors using K-means
- Color Schemes: Generate complementary, analogous, triadic schemes
- Multiple Formats: Export as CSS, JSON, ASE (Adobe Swatch), ACO (Photoshop)
- Color Analysis: RGB, HEX, HSL, HSV values
- Visualization: Palette swatches, color distribution charts
- Batch Processing: Extract palettes from multiple images
- Similarity Matching: Find similar colors across palettes
Quick Start
from color_palette_extractor import ColorPaletteExtractor
extractor = ColorPaletteExtractor()
# Extract colors
extractor.load('image.jpg')
palette = extractor.extract_colors(n_colors=5)
# Export
extractor.export_css('palette.css')
extractor.export_json('palette.json')
extractor.save_swatch('swatch.png')
CLI Usage
# Extract 5 colors
python color_palette_extractor.py --input image.jpg --colors 5 --output palette.json
# With CSS export
python color_palette_extractor.py --input image.jpg --colors 8 --css palette.css --swatch swatch.png
# Batch mode
python color_palette_extractor.py --batch images/ --colors 5 --output palettes/
Dependencies
- pillow>=10.0.0
- scikit-learn>=1.3.0
- numpy>=1.24.0
- matplotlib>=3.7.0
Source
git clone https://github.com/dkyazzentwatwa/chatgpt-skills/blob/main/color-palette-extractor/SKILL.mdView on GitHub Overview
Color Palette Extractor identifies the most dominant colors in an image using K-means clustering and can generate color schemes such as complementary, analogous, and triadic palettes. It supports multiple export formats (CSS, JSON, ASE, ACO) and provides color data in RGB, HEX, HSL, and HSV, plus visualization and batch processing capabilities.
How This Skill Works
Load one or more images, run K-means to extract n_colors dominant colors, and optionally generate color schemes. Use the built-in exporters to save as CSS, JSON, ASE/ACO swatches, or PNG swatch images, with support for batch processing across multiple inputs.
When to Use It
- Designing a brand palette from product photos.
- Building UI themes from hero images or screenshots.
- Producing swatches for design systems and style guides.
- Batch-processing dozens of images for a catalog or gallery.
- Exploring color relationships with complementary and analogous schemes.
Quick Start
- Step 1: from color_palette_extractor import ColorPaletteExtractor; extractor = ColorPaletteExtractor()
- Step 2: extractor.load('image.jpg'); palette = extractor.extract_colors(n_colors=5)
- Step 3: extractor.export_css('palette.css'); extractor.export_json('palette.json'); extractor.save_swatch('swatch.png')
Best Practices
- Use high-quality, well-lit images to improve color stability.
- Start with a modest n_colors (e.g., 5) and adjust based on desired granularity.
- Validate colors across RGB, HEX, HSL, and HSV to ensure consistency.
- Export in formats that fit your workflow (CSS for web, JSON for tokens, ASE/ACO for design tools).
- Visualize palettes with swatch images to spot outliers and ensure balance.
Example Use Cases
- E-commerce site derives CSS color tokens from a product photo.
- Brand guidelines generated from logo variations with JSON exports.
- UI theme built from a hero image using CSS and swatch exports.
- Catalog team batch-processes dozens of images to extract consistent palettes.
- Design system aligns similar colors across multiple palettes for cohesion.
Frequently Asked Questions
Add this skill to your agents