generate_color_palette
Create color palettes from descriptions, moods, industries, or hex colors. Get hex/RGB/HSL values, WCAG accessibility scores, and CSS custom properties for design projects.
Instructions
Generate a color palette from a description, mood, industry, or hex seed color. Accepts moods (calm, energetic, luxurious), industries (fintech, healthcare, fashion), nature themes (sunset, ocean, forest), or a specific hex color. Returns hex/RGB/HSL values, WCAG accessibility scores, and CSS custom properties.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | Description of the desired palette (e.g. 'calm fintech blue', 'sunset', '#3B82F6') | |
| count | No | Number of colors (2-10) | |
| format | No | Color format in output | all |
| includeShades | No | Include light/dark shades for each color |
Implementation Reference
- src/tools/color-palette.ts:256-284 (handler)The primary handler function that processes the tool input and executes the color palette generation logic.
async function handler(input: Input) { const { description, count, format, includeShades } = input; const palette = findBestPalette(description); // Select `count` colors from seeds (cycle if needed) const selected: string[] = []; for (let i = 0; i < count; i++) { selected.push(palette.seeds[i % palette.seeds.length]); } const colors = selected.map((hex, i) => ({ index: i + 1, name: `Color ${i + 1}`, ...formatColor(hex, format), ...(includeShades && { shades: generateShades(hex) }), })); // CSS custom properties const cssVars = selected.map((hex, i) => ` --color-${i + 1}: ${hex};`).join("\n"); return { paletteName: palette.name, paletteLabel: palette.label, colors, css: `:root {\n${cssVars}\n}`, swatches: selected.join(", "), }; } - src/tools/color-palette.ts:5-26 (schema)Input schema definition for the color palette generator tool.
const inputSchema = z.object({ description: z .string() .min(1) .max(500) .describe("Description of the desired palette. E.g. 'sunset over the ocean', 'corporate fintech', 'playful children's brand', '#3B82F6'"), count: z .number() .int() .min(2) .max(10) .default(5) .describe("Number of colors to generate (2-10)"), format: z .enum(["hex", "rgb", "hsl", "all"]) .default("all") .describe("Output color format"), includeShades: z .boolean() .default(false) .describe("Include light/dark shades for each color"), }); - src/tools/color-palette.ts:287-306 (registration)Tool registration for 'color-palette'. Note that 'generate_color_palette' in the server index maps to this underlying tool.
const colorPaletteTool: ToolDefinition<Input> = { name: "color-palette", description: "Generate a color palette from a description or seed color. Supports moods (calm, energetic, luxurious), industries (fintech, healthcare, fashion), nature themes (sunset, ocean, forest), and hex color seeds. Returns hex, RGB, HSL values with WCAG accessibility scores and CSS variables.", version: "1.0.0", inputSchema, handler, metadata: { tags: ["color", "palette", "design", "branding", "css", "accessibility"], pricing: "$0.0005 per call", exampleInput: { description: "calm ocean fintech brand", count: 5, format: "all", includeShades: false, }, }, }; registerTool(colorPaletteTool);