Skip to main content
Glama

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
NameRequiredDescriptionDefault
descriptionYesDescription of the desired palette (e.g. 'calm fintech blue', 'sunset', '#3B82F6')
countNoNumber of colors (2-10)
formatNoColor format in outputall
includeShadesNoInclude light/dark shades for each color

Implementation Reference

  • 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(", "),
      };
    }
  • 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"),
    });
  • 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);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/marras0914/agent-toolbelt'

If you have feedback or need assistance with the MCP directory API, please join our Discord server