Analogous Colors API: Generate Harmonious Color Schemes

Looking for naturally harmonious color combinations? This guide covers the Analogous Colors API, which generates color schemes using colors that sit next to each other on the color wheel, creating cohesive, pleasing palettes often found in nature.

What are Analogous Colors?

Analogous colors are colors that sit adjacent to each other on the color wheel, typically within a 30-degree range. These colors share similar undertones and create inherently harmonious combinations:

  • Example: Blue, Blue-Green, Green
  • Example: Red, Orange, Yellow
  • Example: Purple, Blue-Purple, Blue

Why Analogous Works

Analogous schemes are pleasing because they mimic patterns in nature. Think of autumn leaves (red, orange, yellow) or ocean scenes (blue, teal, green). They create:

  • Visual comfort and cohesion
  • Subtle variation without jarring contrast
  • Professional, sophisticated appearances
  • Easy-to-implement color systems
Design Tip: Use one color as dominant, a second as supporting, and a third as accent. Vary saturation and lightness for added depth.

Using the Analogous Colors API

TinyFn provides an endpoint for generating analogous color schemes:

API Request
GET https://api.tinyfn.io/v1/color/analogous
Headers: X-API-Key: your-api-key
Response
{
  "base": {
    "hex": "#3498db",
    "hsl": { "h": 204, "s": 70, "l": 53 }
  },
  "analogous": [
    { "hex": "#34c0db", "hsl": { "h": 174, "s": 70, "l": 53 }, "rotation": -30 },
    { "hex": "#3498db", "hsl": { "h": 204, "s": 70, "l": 53 }, "rotation": 0 },
    { "hex": "#3470db", "hsl": { "h": 234, "s": 70, "l": 53 }, "rotation": 30 }
  ],
  "angle": 30
}

Parameters

Parameter Type Description
color string Base color in HEX, RGB, or HSL format (required)
count integer Number of analogous colors to generate (3-7). Default: 3
angle integer Degrees between colors (15-45). Default: 30
format string Output format: hex, rgb, hsl, all. Default: all

Code Examples

JavaScript / Node.js

// Get 5 analogous colors
const response = await fetch(
  'https://api.tinyfn.io/v1/color/analogous?' + new URLSearchParams({
    color: '#3498db',
    count: 5,
    angle: 25
  }),
  { headers: { 'X-API-Key': 'your-api-key' } }
);
const result = await response.json();

result.analogous.forEach(color => {
  console.log(`${color.hex} (${color.rotation} degrees)`);
});

Python

import requests

response = requests.get(
    'https://api.tinyfn.io/v1/color/analogous',
    params={
        'color': '#2ecc71',
        'count': 5,
        'angle': 20
    },
    headers={'X-API-Key': 'your-api-key'}
)
result = response.json()

print(f"Analogous colors for {result['base']['hex']}:")
for color in result['analogous']:
    print(f"  {color['hex']}")

cURL

curl "https://api.tinyfn.io/v1/color/analogous?color=%233498db&count=5" \
  -H "X-API-Key: your-api-key"

Common Use Cases

  • UI Design: Create cohesive interface color schemes
  • Branding: Develop harmonious brand palettes
  • Gradients: Use as color stops for smooth gradients
  • Illustration: Build naturalistic color sets
  • Themes: Generate color themes (ocean, forest, sunset)

Best Practices

  1. Add contrast carefully: Analogous schemes lack contrast; add a complement for emphasis
  2. Vary lightness: Use light and dark versions for depth
  3. Choose dominant: Pick one color to dominate, use others as supporting
  4. Consider temperature: Warm analogous (reds-yellows) vs cool (blues-greens) set mood

Use via MCP

Your AI agent can call this tool directly via Model Context Protocol — no HTTP code needed. Add TinyFn to Claude Desktop, Cursor, or any MCP client:

{
  "mcpServers": {
    "tinyfn-color": {
      "url": "https://api.tinyfn.io/mcp/color/",
      "headers": {
        "X-API-Key": "your-api-key"
      }
    }
  }
}

See all color tools available via MCP in our Color MCP Tools for AI Agents guide.

Try the Analogous Colors API

Get your free API key and start generating harmonious color schemes.

Get Free API Key

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key