Palette Contrast
Calculate color contrast and compare it with a supplied minimum.
Description
Color contrast compares relative luminances of foreground and background.
When to use Palette Contrast
Use this tool to calculate color contrast and compare it with a supplied minimum.
Prepare the text, recorded observations, aligned figures or editorial criteria requested. Confirm what each label, count, timestamp or supplied flag represents before interpreting the result.
How to use Palette Contrast and understand its results
- Prepare the text, recorded observations, aligned figures or editorial criteria requested. Confirm what each label, count, timestamp or supplied flag represents before interpreting the result.
- Enter foregroundHex, backgroundHex, minimumContrastRatio using the field table and calculation rules, then run the tool.
- Read contrastRatio, meetsMinimum. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| foregroundHex | Foreground color | string | Required |
| backgroundHex | Background color | string | Required |
| minimumContrastRatio | Minimum contrast ratio | number; minimum: 1 | Required |
Enter exact six-digit #RRGGBB strings and a minimum ratio≥1. Linearize normalized sRGB channels at 0.04045, using c/12.92 below that boundary and ((c+0.055)/1.055)^2.4 above. Weight channels 0.2126, 0.7152, 0.0722; return ratio and inclusive gate.
contrast=(max(L1,L2)+0.05)/(min(L1,L2)+0.05) Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| contrastRatio | Contrast ratio | number; minimum: 1 |
| meetsMinimum | Meets supplied minimum | boolean |
{
"input": {
"foregroundHex": "#000000",
"backgroundHex": "#ffffff",
"minimumContrastRatio": 7
},
"output": {
"contrastRatio": 21,
"meetsMinimum": true
}
} Limitations and assumptions
No alpha blending, gradients, rendered text, font size or whole-page accessibility is evaluated.
Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors. A successfully returned false flag is an evaluated outcome; its meaning is explained above.
Alternative or Complementary methods
Use Choropleth Bin Classifier: Classify numeric map values with quantile or Jenks natural-break bins. For a complementary task, use Lower-Third Fit: Check lower-third line and total character limits.
Further background: Understanding Contrast (Minimum).
References
-
Palette Contrast — tool.io
-
Understanding Contrast (Minimum) — World Wide Web Consortium
Similar or alternative tools
- Choropleth Bin Classifier
Classify numeric map values with quantile or Jenks natural-break bins.
- Lower-Third Fit
Check lower-third line and total character limits.