Color Utilities

Invert Color

Inverts any color by flipping RGB values to their opposites (255 minus each component). Use via MCP in Cursor or Windsurf, or call GET /v1/color/invert with hex, RGB, or HSL input. Perfect for creating contrasting themes or accessibility features. Returns the inverted color in multiple formats including hex and RGB values.

API Endpoint

GET /v1/color/invert

Code Examples

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

Pass the hex value to the endpoint and get the mathematical inverse where each RGB component becomes 255 minus its original value. #FF5733 becomes #00A8CC.

Can MCP tools in Cursor automatically invert colors in my CSS?

Yes, MCP integration lets AI agents parse your CSS colors and generate inverted values for dark mode themes or contrast adjustments directly in your code.

What's the difference between color inversion and complementary colors?

Inversion flips RGB values mathematically (255-R, 255-G, 255-B) while complementary colors use color theory relationships on the color wheel.

Does color inversion work with transparency/alpha channels?

The tool inverts RGB components only. Alpha transparency values remain unchanged in the output.

What color formats does the invert endpoint accept?

Accepts hex (#RRGGBB), RGB (rgb(r,g,b)), and HSL (hsl(h,s,l)) formats. Returns inverted results in multiple standard formats.

Try Invert Color Now

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

Get Free API Key