Color Utilities

Random Color

Generates random colors in hex, RGB, or HSL formats via GET /v1/color/random. Perfect for AI agents building UIs, generating design mockups, or creating color palettes programmatically. Returns deterministic output based on optional seed parameter. Works seamlessly in MCP-enabled editors like Cursor and Windsurf for instant color generation during development.

API Endpoint

GET /v1/color/random

Code Examples

curl "https://tinyfn.io/v1/color/random" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/color/random', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/color/random',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's color tools:

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

Learn more about MCP setup →

FAQ

How do I generate a random color in hex format?

Call GET /v1/color/random with no parameters to get a hex color like #3A7BD4. Add ?format=hex explicitly if needed.

Can I get reproducible random colors with a seed?

Yes, use ?seed=123 to generate the same color every time. Essential for consistent design systems and testing scenarios.

What color formats are supported besides hex?

Supports RGB (rgb(58, 123, 212)), HSL (hsl(215, 66%, 53%)), and named colors. Use ?format=rgb or ?format=hsl parameters.

How does this work with MCP in AI coding assistants?

AI agents can generate colors on-demand for CSS, design tokens, or UI components without hallucinating invalid hex codes or color values.

Can I generate multiple random colors at once?

Make multiple API calls or use ?count=5 parameter if supported. Each call with different seeds ensures unique color sets for palettes.

Try Random Color Now

Get your free API key and start using Random Color in seconds.

Get Free API Key