color-palette-generator
Skill1 starsChanged 4 months agoMITView on GitHub
Use when the user wants a color palette for a web project, wants to extract colors from an image or screenshot, wants a palette based on a mood or base color, or says "generate a color palette", "extract colors from this image", or "give me a color scheme".
1 other project uses a version of this.
Adopted by
Most recently taken up by
- AlpacaLabsLLC/skills-for-architectstheir own version, first seen Sep 20, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- AlpacaLabsLLC/skills-for-architects★ 420same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository58 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- api-test-suiteSkill
- ascii-artSkill
- caddy-reverse-proxySkill
- changelog-generatorSkill
- cron-taskSkill
- csv-toolkitSkill
- discord-bot-buildSkill
- docker-umbrellaSkill
- dotfiles-manageSkill
- email-sendSkill
- env-config-managerSkill
- excalidraw-diagramSkill
- file-organizerSkill
- forgejo-self-hostSkill
- frontend-design-toolkitSkill
- generate-dockerfileSkill
- gif-searchSkill
- git-backupSkill
- github-actions-ciSkill
- hallmark-readmeSkill
- http-api-testerSkill
- invoice-generatorSkill
- json-formatterSkill
- log-analyzerSkill
- markdown-linterSkill
- markdown-to-pdfSkill
- markdown-to-slidesSkill
- mcp-server-buildSkill
- media-id-mappingSkill
- movie-catalogue-siteSkill
- movie-night-calendarSkill
- ntfy-notifierSkill
- ocr-documentsSkill
- ollama-localSkill
- openapi-generatorSkill
- password-generatorSkill
- pdf-extractSkill
- portfolio-upkeepSkill
- qr-code-generatorSkill
- regex-testerSkill
- resume-builderSkill
- rss-monitorSkill
- searxng-self-hostSkill
- skill-publishSkill
- skill-registry-catalogSkill
- skills-portfolio-scaffoldSkill
- snippet-managerSkill
- sqlite-dashboardSkill
- streaming-provider-embedsSkill
- tailscale-deploySkill
- telegram-bot-buildSkill
- tmdb-metadataSkill
- uptime-kuma-self-hostSkill
- watchlist-syncSkill
- webhook-receiverSkill
- youtube-transcriptSkill
The file
Files
color-palette-generator
Overview
Generate color palettes from images, keywords, or base colors. The agent extracts dominant colors from images, generates complementary palettes from a seed color, and produces CSS custom properties ready to use.
When to Use
- The user wants a color palette for a web project.
- The user wants to extract colors from an image or screenshot.
- The user wants a palette based on a mood or keyword.
- The user says "generate a color palette", "extract colors from this image", or "give me a color scheme".
Extract Colors from Image
from PIL import Image
from collections import Counter
def extract_palette(image_path: str, num_colors: int = 6) -> list:
"""Extract dominant colors from an image."""
img = Image.open(image_path)
img = img.convert("RGB")
img = img.resize((150, 150)) # downsize for speed
pixels = list(img.getdata())
counter = Counter(pixels)
palette = []
for color, count in counter.most_common(num_colors * 3):
# Skip colors too similar to already-selected ones
too_close = False
for existing in palette:
if sum(abs(a - b) for a, b in zip(color, existing)) < 50:
too_close = True
break
if not too_close:
palette.append(color)
if len(palette) >= num_colors:
break
return [{"hex": rgb_to_hex(c), "rgb": c} for c in palette]
def rgb_to_hex(rgb: tuple) -> str:
return f"#{rgb[0]:02x}{rgb[1]:02x}{rgb[2]:02x}"Generate from Base Color
import colorsys
def generate_palette(base_hex: str, scheme: str = "analogous") -> list:
"""Generate a palette from a base color."""
r, g, b = int(base_hex[1:3], 16), int(base_hex[3:5], 16), int(base_hex[5:7], 16)
h, s, v = colorsys.rgb_to_hsv(r/255, g/255, b/255)
colors = []
if scheme == "analogous":
offsets = [-30, -15, 0, 15, 30]
for offset in offsets:
new_h = (h + offset/360) % 1.0
rgb = colorsys.hsv_to_rgb(new_h, s, v)
colors.append(rgb_to_hex((int(rgb[0]*255), int(rgb[1]*255), int(rgb[2]*255))))
elif scheme == "complementary":
new_h = (h + 0.5) % 1.0
for sat in [s, s*0.7, s*0.5]:
rgb = colorsys.hsv_to_rgb(h, sat, v)
colors.append(rgb_to_hex((int(rgb[0]*255), int(rgb[1]*255), int(rgb[2]*255))))
rgb = colorsys.hsv_to_rgb(new_h, sat, v)
colors.append(rgb_to_hex((int(rgb[0]*255), int(rgb[1]*255), int(rgb[2]*255))))
elif scheme == "triadic":
for offset in [0, 120, 240]:
new_h = (h + offset/360) % 1.0
rgb = colorsys.hsv_to_rgb(new_h, s, v)
colors.append(rgb_to_hex((int(rgb[0]*255), int(rgb[1]*255), int(rgb[2]*255))))
elif scheme == "monochrome":
for val in [0.3, 0.5, 0.7, 0.85, 1.0]:
rgb = colorsys.hsv_to_rgb(h, s, val)
colors.append(rgb_to_hex((int(rgb[0]*255), int(rgb[1]*255), int(rgb[2]*255))))
return colorsCSS Custom Properties Output
def palette_to_css(palette: list, name: str = "palette") -> str:
"""Generate CSS custom properties from a palette."""
css = ":root {\n"
for i, color in enumerate(palette, 1):
hex_val = color["hex"] if isinstance(color, dict) else color
css += f" --color-{name}-{i}: {hex_val};\n"
css += "}"
return cssWorkflow
- Determine the source: image, base color, or keyword
- For images: extract dominant colors with deduplication
- For base colors: generate analogous/complementary/triadic/monochrome scheme
- Convert to hex
- Optionally output as CSS custom properties
- Return the palette
Common Pitfalls
- Near-identical shades pass the dedup filter. Raw color extraction returns many near-identical pixels. The distance-< 50 threshold filters most, but on low-contrast images it can still let through two colors that read as the same to the eye — or, on high-contrast images, reject colors that should have been kept. Check the returned hexes visually, don't trust the threshold blindly.
- Extracting from a huge image is slow. A 5000x5000 image has 25M pixels to count. Always downsize first (the code resizes to 150x150) before running
Counter. - RGBA images skew the palette. Images with an alpha channel need
img.convert("RGB")first, or transparent/semi-transparent pixels get counted as if they were opaque colors. - Wrong scheme for the mood. "Analogous" is safe for most projects. "Complementary" can be visually jarring if applied without restraint. "Monochrome" is elegant but risks low contrast for text/background pairs — check contrast ratio, not just hue.
- Hex output isn't perceptually uniform. This skill generates hex/RGB colors via HSV math, not OKLCH. For a palette that needs consistent perceived lightness across hues, convert to OKLCH afterward (see
hallmark-readme/frontend-design-toolkit). - Palette is light-mode only. The generated palette targets light backgrounds. For a dark theme, don't reuse it as-is — invert lightness per color while keeping hue constant, and re-check contrast.
Verification Checklist
- Extracted or generated hex values were rendered/previewed, not just returned as strings
- Source image was downsized before extraction (large images not passed directly to
Counter) - RGBA images were converted to RGB before extraction
- Chosen scheme (analogous/complementary/triadic/monochrome) matches the stated mood or use case
- If used for text-on-background pairs, contrast was checked (not just hue difference)
- CSS custom properties output (if requested) was validated as parseable CSS
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

