Lightest color in a list
From #000000, #808080 and #ffffff, the lightest is #ffffff at position 2 (counting from 0), with luminance 1. Rank brand, surface and accent colors the way the eye sees them, not by guesswork. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Colors
- #000000, #808080, #ffffff
- Quantity
- 3
- Index
- 2
- Color
- #ffffff
- Hex
- #ffffff
Design systems, theme generators, and accessibility reviews often start with a handful of candidate hex codes and need a single answer to a simple question: which swatch is the lightest? Eye-balling midtones is unreliable, and raw RGB averages ignore how the human eye weights green far more than blue. This capability takes a list of CSS hex colors, computes WCAG 2.x relative luminance for each entry after proper sRGB linearization, and returns the lightest color together with its zero-based index in the original list. Ties are resolved deterministically by keeping the earliest occurrence, so automated pipelines never flip between two equal whites depending on runtime.
How relative luminance picks the lightest swatch
Relative luminance is the WCAG measure of how bright a color appears under standard viewing conditions. Unlike HSL lightness, which treats red, green, and blue symmetrically after conversion, relative luminance starts from eight-bit sRGB channels, converts each channel to a unit fraction, linearizes the gamma-encoded values with the piecewise sRGB transfer function, and combines them with fixed coefficients: zero point two one two six for red, zero point seven one five two for green, and zero point zero seven two two for blue.
Those weights match the standard observer, so pure green ranks much lighter than pure blue even when both channels sit at two hundred fifty-five. When two entries share the exact same luminance value, the algorithm keeps the lower index so the result is stable across languages and runtimes. Short three-digit hex codes expand to six digits before parsing; leading hash marks are optional; alpha forms with four or eight digits are rejected because the contract is opaque RGB only.
There is no random seed, wall-clock timestamp, or network call in the path, so the same list always yields the same winner, index, and rounded luminance array.
Where finding the lightest color earns its keep
Product designers ranking brand, surface, and accent tokens need a fast way to mark the lightest background candidate before checking contrast against body text. Design-token pipelines generate tints from several base hexes and must pick the lightest step for paper-white surfaces without opening a full image editor. Accessibility reviewers compare candidate icon colors on dark chrome and want the lightest option for secondary labels, then hand that pair to a contrast checker.
Marketing teams assemble campaign palettes from logo extractions and need a reproducible ranking when several near-whites look identical on a projector. If you later need to darken a single hex, compute contrast ratios, convert to HSL, or build complementary schemes, treat those as separate search intents and landings rather than overloading this lightest-in-list page.
What you can do with it
Pick the lightest surface token
Rank brand and theme hex candidates by WCAG relative luminance and keep the lightest swatch as the paper-white or card background token.
Accessibility palette triage
From a short list of icon or label colors, select the lightest option for dark chrome before running a full contrast check.
FAQ
How is the lightest color chosen?
The maximum L wins; exact ties keep the lowest index.
What hex formats are accepted?
Three-digit and six-digit CSS hex, with or without a leading hash, case-insensitive.
How many colors can I send?
Between 1 and 64 inclusive. An empty array or more than 64 entries fails validation and is not billed.
What happens when two colors have the same luminance?
The first occurrence (lowest zero-based index) is returned so results stay deterministic across runtimes.
What does the lightest-color finder cost?
The browser tool is free and runs locally.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/color/lightest-in-list \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"colors":["#000000","#808080","#ffffff"]}'const res = await fetch("https://api.kit.forhosting.com/color/lightest-in-list", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"colors": [
"#000000",
"#808080",
"#ffffff"
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/color/lightest-in-list",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"colors": [
"#000000",
"#808080",
"#ffffff"
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/color/lightest-in-list", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"colors":["#000000","#808080","#ffffff"]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"colors":["#000000","#808080","#ffffff"]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/color/lightest-in-list", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"colors": [
"#000000",
"#808080",
"#ffffff"
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "color.lightest_in_list",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Invalid hex strings, empty lists, and oversized arrays fail with invalid_input instead of inventing a winner.
How relative luminance picks the lightest swatch
This endpoint applies that formula to every color in your list, then selects the maximum luminance.
Input contract, response shape, and validation rules
Each entry may be hash-RGB or hash-RRGGBB, with or without the leading hash, in any case. Example: black, mid gray, and white returns white at index two with luminance one. Example: pure red, pure green, and pure blue returns green at index one because the green coefficient dominates. Wire the free browser form when reviewing a palette by hand, then call the identical contract from scripts when you need bulk ranking of token ladders or theme candidates. POST a JSON object with a required colors field: an array of one to sixty-four hex color strings. Aliases list, swatches, and palette are accepted for the same field. Missing colors, a non-array value, an empty array, more than sixty-four entries, non-hex characters, wrong lengths, and alpha forms all fail with invalid_input naming the offending field or index; failed validation is not billed. On success the response includes count as the list length, index as the zero-based position of the lightest color, color and hex as the normalized lowercase six-digit code with a leading hash, integer r g b channels, a printable rgb string, relative_luminance of the winner as a clean floating-point number between zero and one, luminances as the cleaned luminance of every input in order, and a short formula string documenting the WCAG pipeline. Pricing for successful API calls is the published base of $0.002 per item.
Where finding the lightest color earns its keep
Because this capability is a pure parse engine, every successful call costs the published $0.002 base price with no model tokens and no outbound network, and failed validation does not consume prepaid balance.
Integration use cases
CI golden for theme ladders
Assert in continuous integration that the lightest step of a generated tint ladder stays at the expected index and hex after palette changes.