New Year special · 2027 lucky colours ↗

Shades of Yellow: CSS Colors and Readable Highlight Examples

For screen use, yellow shades include pale references such as lightyellow #FFFFE0, brighter yellow #FFFF00 and muted darkkhaki #BDB76B. Keep the exact code and its role together: a yellow that works behind black text can be difficult to read as lettering on white.

This resource selects eight entries from the CSS named-color table for a yellow-family study. It provides a practical highlight experiment, rather than assigning a universal code to every natural-language shade name. The comparison is static HTML and CSS, with no account or JavaScript required.

Eight yellow-family references, with text-pair checks

The W3C CSS Color 4 named-color table supplies the keyword, HEX and RGB values below. The current publication is a Candidate Recommendation Draft. Our selection and grouping are editorial. The specification does not define this as a complete yellow taxonomy or an evenly spaced scale.

Reference and codeText on this opaque fill
Light yellow
#FFFFE0
lightyellow
rgb(255, 255, 224)
Black: 20.63:1
White: 1.02:1
Lemon chiffon
#FFFACD
lemonchiffon
rgb(255, 250, 205)
Black: 19.81:1
White: 1.06:1
Light goldenrod yellow
#FAFAD2
lightgoldenrodyellow
rgb(250, 250, 210)
Black: 19.67:1
White: 1.07:1
Pale goldenrod
#EEE8AA
palegoldenrod
rgb(238, 232, 170)
Black: 16.76:1
White: 1.25:1
Khaki
#F0E68C
khaki
rgb(240, 230, 140)
Black: 16.40:1
White: 1.28:1
Gold
#FFD700
gold
rgb(255, 215, 0)
Black: 14.97:1
White: 1.40:1
Yellow
#FFFF00
yellow
rgb(255, 255, 0)
Black: 19.56:1
White: 1.07:1
Dark khaki
#BDB76B
darkkhaki
rgb(189, 183, 107)
Black: 10.15:1
White: 2.07:1

For these eight exact fills, black text is above the normal-text 4.5:1 threshold and white text is below it. Decisions use the unrounded ratio. That does not certify other text colors, a complete page, or text placed over a photograph, gradient or transparent layer.

CSS keywords are specific digital references. For example, CSS gold means the flat value #FFD700. It does not add a metallic surface. The gold reference discusses that separate naming and material question. Keep a paint or fabric maker's identifier with any physical sample instead of treating a screen swatch as a match.

Keep the words. Switch yellow from letters to a marker

The phrase is always river route. The visual specimen reads “Search result: river route.” Choose which part receives the yellow: the letter shapes or the surface behind them. The white surrounding panel stays fixed.

Choose the yellow's role

Yellow letters selected: #FFFF00 on #FFFFFF gives 1.07:1, below 4.5:1. This deliberately failing specimen repeats the phrase provided above.

Yellow marker selected: #000000 on #FFFF00 gives 19.56:1, above 4.5:1 for this pair.

Use Tab to reach the radio group and arrow keys to switch options. Written labels identify both modes. If styles are unavailable, both explanations remain in the document. This is a fixed two-mode comparison, not an arbitrary contrast checker.

Why bright yellow can fail as text on white

The WCAG relative-luminance formula linearizes sRGB channels before weighting red, green and blue. For #FFFF00, the linear values are R = 1, G = 1, B = 0. Its relative luminance is:

L = 0.2126 × 1 + 0.7152 × 1 + 0.0722 × 0
L = 0.9278
Against white: (1 + 0.05) ÷ (0.9278 + 0.05) ≈ 1.07:1
Against black: (0.9278 + 0.05) ÷ (0 + 0.05) ≈ 19.56:1

The WCAG contrast explanation sets 4.5:1 as the normal-text AA threshold, with separate provisions for large text. A color's vivid appearance is not the same as enough luminance contrast. Reversing a foreground/background pair keeps its contrast ratio, so white letters on yellow fail the same numerical check as yellow letters on white.

Moving yellow to the background in the experiment also changes the foreground to black. That is why the result improves. Merely swapping yellow letters and white background would leave the ratio unchanged.

A highlight also needs a clear purpose

MDN describes the HTML mark element as marking text relevant to its surrounding context, such as a matching passage. Use the example to think about what is being identified, then choose its colors. A yellow rectangle by itself does not explain whether something is a search match, a warning, a selection or a decorative accent.

<p>Search result: <mark class="match">river route</mark></p>
.match { background: #FFFF00. Color: #000000; }

This is a small authored example, not a required universal highlight style. Keep the matching phrase in the sentence, preserve readable text and check the actual implementation. A status message should state its status in words. A decorative swatch should have an adjacent name or code when identification matters.

An original handoff exercise: specify the role before the shade

  1. Start with a job. Imagine a search-results page that needs to identify a matching phrase. Keep its sentence and font size unchanged while comparing two highlight fills.
  2. Choose a reference. Try yellow #FFFF00 and lemonchiffon #FFFACD with black text. Both pass the pair check shown above, but their visual prominence differs. Decide in the context of the actual page.
  3. Record two codes. Write the foreground and background separately. “Yellow text” and “yellow highlight” are different specifications.
  4. Preserve the meaning. Record that the highlighted words are a search match. Give warnings or other statuses their own explicit wording rather than reusing the color without explanation.
  5. Check the final layout. Test its actual text size, wrapping and neighboring controls. A pair calculation does not check the entire interaction.
Example record
Purpose: identify the matching phrase in a search result
Text: #000000
Highlight fill: #FFFACD, opaque
Words retained: river route
Normal-text pair ratio: 19.81:1
Still to check: final layout, wrapping and interaction

If a request instead calls for yellow lettering on a dark surface, record that exact surface and calculate the new pair. Do not reuse the white-background result or declare every yellow unsuitable for text.

Continue with the right tool

Use the HEX preview to read an opaque code, the three-role palette table to record background/text/accent values, or the palette generator to derive a separate five-slot starting group. None of those steps matches a physical material.

The blue experiment answers a different question about opaque mixes and transparency. For EssaColor's separate personal service, My Colors requires sign-in and birth-profile binding and is currently free. See method and limits. This public yellow study does not change the stored color library or personal rules.

Original yellow selection, pair calculations, role-switching specimen and handoff exercise by EssaColor. Technical sources are linked beside the relevant claims. No new images, scripts, storage or input collection are needed for the experiment.

Picks for this page

8 picks, 8 available now. Prices are set by the store.