Get color

CDN · Reads onchain state

Returns the dominant color of a hosted image along with a text color that stays readable on top of it. The pair is computed once and served from the CDN, so surfaces themed around remote assets, token icons, protocol logos, NFT media, get their palette in one cheap call instead of shipping color extraction to the client. Reach for it whenever UI wraps an image it has never seen: card backgrounds, hover washes, any place the design should take its color from the asset instead of a default.

Send a request

Response

{
links: {
self: string
prev: string | undefined
next: string | undefined
} | undefined
headers: unknown | undefined
data: {
color: string
textColor: string
} | null
}

Code samples

Language

Claude

Prompt

Call the Plug API endpoint "Get color".
## Endpoint
GET /cdn/{encoded_url}/color
Base URL: https://api.plug.to
## Description
Returns the dominant color of a hosted image along with a text color that stays readable on top of it.
The pair is computed once and served from the CDN, so surfaces themed around remote assets, token icons, protocol logos, NFT media, get their palette in one cheap call instead of shipping color extraction to the client.
Reach for it whenever UI wraps an image it has never seen: card backgrounds, hover washes, any place the design should take its color from the asset instead of a default.
## Path Parameters
- encoded_url (string, required) — Base64url encoding of the absolute asset URL, the same segment the /cdn proxy serves the image from.
## Headers
- Accept (string, required) — For a typical single-time JSON response, set this to application/json. To receive realtime updates through a stream, set this to text/event-stream. (default: application/json) [application/json, text/event-stream]
Current value: application/json
## Response Schema
- links (object, optional)
- self (string, required)
- prev (string, optional)
- next (string, optional)
- headers (unknown, optional)
- data (object, optional)
- color (string, required)
- textColor (string, required)
## Example Request
GET https://api.plug.to/cdn/{encoded_url}/color