πŸ–ΌοΈ

Color Palette Generator

Extract dominant colors from images and export as design palettes (HEX, RGB, CSS variables).

Image ⭐⭐ Intermediate ⏱️ 3 minutes

😫 The Pain Point

You’re designing a website and want colors that match the hero image. Manually picking colors with an eyedropper is tedious and often misses the best combinations.

πŸš€ Agentic Solution

An Automatic Palette Extractor that finds the most visually important colors in any image.

Key Features:

  • Dominant Colors: Extracts 5-10 most prominent colors.
  • Export Formats: HEX, RGB, HSL, CSS variables.
  • Batch Mode: Process multiple images for brand consistency.

βš”οΈ Phase 1: Commander (Quick Fix)

For quick palette extraction.

Prompt:

β€œI have an image hero.jpg. Write a Python script using colorthief to:

  1. Extract: Get the 6 most dominant colors.
  2. Output Formats:
    • Print as HEX codes.
    • Save as palette.json with HEX and RGB values.
    • Save as palette.css with CSS custom properties.
  3. Visual: Create a color swatch image (600x100px).

For batch mode, accept a folder path and process all images.”

Result: Ready-to-use color palettes for design.

πŸ—οΈ Phase 2: Architect (Permanent Tool)

For Designers.

Engineering Prompt:

**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "Color Palette Generator" Desktop App

**Objective:** A design tool to extract and export dominant color palettes from images for branding work.

**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Algorithms: colorthief or k-means
* Packaging: PyInstaller

**Functional Requirements:**
1.  **UI Layout (PyQt6):**
    *   **Input:** Single Image or Folder Batch Selection.
    *   **Controls:** Slider for "Color Count" (3-10).
    *   **Exports:** Checkboxes for JSON, CSS, ASE (Adobe Swatch), Standard Image Swatch.
    *   **Preview:** Visual representation of the palette.

2.  **Core Logic:**
    *   Extract K dominant colors.
    *   Sort colors by luminance or saturation.
    *   **Threading:** Process large images in background thread.

3.  **Deliverables:**
    *   `main.py`: Complete source code.
    *   `requirements.txt`: Dependencies.
    *   **Build Instructions:**
        *   Windows: `pyinstaller --onefile --noconsole main.py`
        *   macOS: `pyinstaller --windowed --noconsole main.py`

🧠 Prompt Decoding

  • Color Thief: Uses k-means clustering to find clusters of similar pixels, returning the β€œaverage” color of each cluster.

πŸ› οΈ Instructions

  1. Install: pip install colorthief
  2. Copy Prompt β†’ Run.

Related Workflows

Explore other categories

πŸ“¬

Get Started with Agentic Working

Subscribe to receive updates from AgenticWorking.io

πŸ“– Free eBook Guide πŸ“¦ 7 Ready-to-use Scripts πŸ”” Weekly Tips

No spam, unsubscribe anytime. Join 1,000+ subscribers.