Color Utilities

Grayscale Color

Converts any color format to grayscale using perceptual luminance weighting. Use via MCP in Cursor or Windsurf, or call GET /v1/color/grayscale with hex, RGB, or HSL input. Returns precise grayscale values in multiple formats. Uses the standard luminance formula (0.299*R + 0.587*G + 0.114*B) for accurate human perception.

API Endpoint

GET /v1/color/grayscale

Code Examples

curl "https://tinyfn.io/v1/color/grayscale" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/color/grayscale', {
  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/grayscale',
    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

What color formats can I convert to grayscale?

Accepts hex (#FF5733), RGB (rgb(255,87,51)), HSL (hsl(12,100%,60%)), and named colors (red, blue). Returns grayscale in hex, RGB, and HSL formats.

How does the grayscale conversion calculate luminance?

Uses the standard perceptual luminance formula: 0.299*Red + 0.587*Green + 0.114*Blue. This weights green highest since human eyes are most sensitive to green light.

Can MCP agents use this for batch color processing?

Yes, AI agents in Claude Code or Cline can call this tool repeatedly for color palette analysis, UI mockup processing, or accessibility testing workflows.

What's the difference between this and simple RGB averaging?

Simple averaging treats all colors equally, but this uses perceptual weighting. #00FF00 (pure green) becomes much lighter than #FF0000 (pure red) due to human vision sensitivity.

Does the grayscale conversion preserve alpha transparency?

Alpha channels are maintained when present in the input format. The RGB values are converted to grayscale while keeping the original transparency level intact.

Try Grayscale Color Now

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

Get Free API Key