AI Color Palette Generator — Agent Skill
AI Color Palette Generator — Agent Skill
Generate harmonious color palettes from text descriptions using AI Pass chat completions.
Setup
Get API key: https://aipass.one/panel/developer.html → API Keys
export AIPASS_API_KEY="your-key-here"
Generate Color Palette
import requests
import os
import json
AIPASS_API_KEY = os.environ["AIPASS_API_KEY"]
def generate_palette(description, style="harmonious"):
"""Generate color palette from description.
Args:
description: Theme or mood (e.g., "calming beach sunset")
style: Palette style (harmonious, bold, pastel, monochromatic, earth-tones, neon)
Returns:
List of hex color codes
"""
response = requests.post(
"https://aipass.one/apikey/v1/chat/completions",
headers={
"Authorization": f"Bearer {AIPASS_API_KEY}",
"Content-Type": "application/json"
},
json={
"model": "gpt-5-mini",
"messages": [
{
"role": "system",
"content": "You are a color expert. Generate 5-7 hex color codes for a palette. Return valid JSON array of hex codes only."
},
{
"role": "user",
"content": f"Create a {style} color palette for: {description}. Return only a JSON array of hex codes like [\"#RRGGBB\", ...]"
}
]
}
)
if response.status_code != 200:
raise Exception(f"Error: {response.text}")
content = response.json()["choices"][0]["message"]["content"]
# Parse JSON (handle markdown wrapping)
try:
colors = json.loads(content)
except json.JSONDecodeError:
if json)[1].split( in content:
json_str = content.split()[0].strip()
colors = json.loads(json_str)
else:
raise Exception(f"Could not parse JSON: {content[:200]}...")
return colors
# Example usage
if __name__ == "__main__":
colors = generate_palette("calming beach sunset", "pastel")
print("Generated palette:")
for color in colors:
print(f" {color}")
# CSS variables
print("\nCSS Variables:")
for i, color in enumerate(colors, 1):
print(f" --color-{i}: {color};")
Export Options
def export_json(palette, filename="palette.json"):
"""Export palette to JSON."""
with open(filename, w) as f:
json.dump(palette, f, indent=2)
print(f"Exported to {filename}")
def export_adobe_color(palette):
"""Generate Adobe Color URL."""
hex_str = .join([c.lstrip(#) for c in palette])
url = f"https://color.adobe.com/create/color-wheel/?base={hex_str[0:6]}"
return url
Notes
- Model: gpt-5-mini
- Styles: harmonious, bold, pastel, monochromatic, earth-tones, neon
- Output: JSON array of hex codes (#RRGGBB)
- Perfect for: branding, web design, UI/UX, art projects