Farbsprache
DeutschDE

Make text readable on an image

The page calculates how dense a scrim must be so your text stays readable on any photo.

Minimum opacity · CSS for the scrim · values for your template

Hex, rgb(), hsl() or oklch(). The color is part of the page address, which the web server receives on each visit. Your browser remembers the last color you used.

Want to create the image first? AI image →

Starter palette

Target

Your palette

All formats ↓

For normal text (4.5:1) the scrim needs an opacity of at least 54%. Over the worst pixel this gives the blended color #757575 with 4.60:1 at 8 bit.

Calculated in floating point, the contrast there is slightly lower. That value counts, and the Values format lists it.

The worst pixel is pure white, because your text is lighter than the scrim. The page calculates against it, so the value holds over any photo.

  • Text title and subtitle on the image#FFFFFF4.60:1 on blended color (8-bit) · meets 4.5:1
  • Scrim semi-transparent layer between image and text#000000
  • Worst pixel pure white or black that the page calculates against#FFFFFF
  • Blended color (8-bit) scrim over the worst pixel at minimum opacity#757575

Minimum opacity · CSS for the scrim · values for your template

How it looks

Format
Safe margin
Simulation

The simulation approximates strong forms for an average observer. It does not replace testing with people who have color vision deficiency.

Walks through the cityA stroll in ten pictures
light
Walks through the cityA stroll in ten pictures
dark
Walks through the cityRead more
busy

Each surface contains pure white and pure black. The scrim has exactly the minimum opacity.

Dashed: safe margin of 64 px (convention)

Copy

Scrim CSS

Splitting into a fully covered lower field up to 40% and a fade up to 70% is a convention of this page.
/* Farbsprache · White on black · Text on image · calculated on 2026-10-31
   Text #FFFFFF on scrim #000000 · target 4.5:1 · minimum opacity 54%
   Holds over any photo, because it is calculated against a pure white pixel (#FFFFFF).
   Place text only in the lower 40%, where the scrim covers fully.
   Values and checks: https://grundhofer.github.io/farbsprache/en/text-on-image/?p=white-on-black */
.hero {
  background:
    linear-gradient(to top, rgb(0 0 0 / 0.54) 0%, rgb(0 0 0 / 0.54) 40%, rgb(0 0 0 / 0) 70%),
    url("image.jpg") center / cover;
  color: #FFFFFF;
}

Values

Farbsprache · White on black · Text on image · calculated on 2026-10-31
Text color           #FFFFFF
Scrim color          #000000
Target               4.5:1 (normal text, WCAG 2.2, 1.4.3)
Minimum opacity      54% (alpha 0.54)
Worst pixel          #FFFFFF (pure white, because the text is lighter than the scrim)
Blended color there  #757575
Contrast there       4.58:1 in floating point, 4.60:1 at 8 bit, the smaller one counts: 4.58:1
Text area            lower 40% of the height fully covered, fade up to 70% (convention)

Values and checks: https://grundhofer.github.io/farbsprache/en/text-on-image/?p=white-on-black

Prompt for coding agents

For templates of OG images and thumbnails: hex values only, no CSS variables

Implement the following scrim for text on images in this project, for example in a template for OG images, thumbnails or hero sections. Use exactly these hex values and this opacity. Write the values directly, without CSS variables.

# Scrim “White on black” for text on images

## Idea
A scrim in #000000 sits in the lower part of the image between photo and text. It is dense enough that text in #FFFFFF reaches at least 4.5:1 over any photo, even over a pure white pixel.

## Values
- Text color: #FFFFFF
- Scrim color: #000000
- Minimum opacity: 54%, as alpha 0.54
- Target: 4.5:1 per WCAG 2.2, calculated against the worst pixel #FFFFFF
- Contrast there at this opacity: 4.58:1, blended color #757575

## Structure
- Lay the scrim over the image as a gradient from bottom to top: up to 40% of the height at full minimum opacity, then fading to 0 at 70%.
- In CSS: linear-gradient(to top, rgba(0, 0, 0, 0.54) 0%, rgba(0, 0, 0, 0.54) 40%, rgba(0, 0, 0, 0) 70%)
- With hex and alpha: #0000008A up to 40%, then fading to #00000000 at 70%.
- Place text only in the lower field up to 40% of the height. Above it the scrim is not enough.

## Rules
- Calculate the scrim against the least favorable spot of the image: light text against pure white, dark text against pure black. Then it works over any photo. White text on a black scrim needs at least 54% for 4.5:1. (Standard: WCAG 2.2, 1.4.3; Failure F83, informative)
- Place text only where the scrim fully covers the image, usually in the lower part. With a gradient, the opacity counts at every spot with text, not on average. (Convention)
- Check against the least favorable image of the series, not the sample image: the brightest behind light text, the darkest behind dark text. A scrim that works on one image often fails on the next. (Convention)
- Give links and buttons on images a two-color focus ring of a light and a dark color, for example white inside and black outside with 21.00:1 between them. According to technique C40, at least one of the two colors then reaches 3:1 on any solid background. Over a photo this does not replace checking the spots behind the ring. (Standard: WCAG 2.2, 2.4.7 and 1.4.11; Technique C40, informative)

## Avoid
- Text in the fading part of the gradient or over the bare image.
- A thinner scrim because the sample image is dark.
- Text shadows as the only measure.

## Check in the product
- Check the template with a pure white and a pure black test image.
- Check focus rings of links and buttons on the image at the spots behind the ring.
- At the end, name which images you checked and which you did not.

## Tip
Keep the values as constants in one place. Then the scrim stays equally dense in every template.

---
Source: Farbsprache, Text on image, starter palette White on black, calculated on 2026-10-31. Values and checks: https://grundhofer.github.io/farbsprache/en/text-on-image/?p=white-on-black

Checked: 1 pair, 1 passes

PairContrastRequirementResult
Text on Blended color (8-bit) text/composite4.60:14.5:1 WCAG 2.2, 1.4.3passes ✓
Calculation

Luminance #FFFFFF = 1.0000 · #757575 = 0.1779 · (1.0000 + 0.05) / (0.1779 + 0.05) = 4.60:1

Not checked

images shown brighter than white (HDR), your font size and weight, text shadows, outlines and blur, cropping and compression by platforms, focus rings over the image, mild forms of color vision deficiency

Rules (4)

  • Standard

    Calculate the scrim against the least favorable spot of the image: light text against pure white, dark text against pure black. Then it works over any photo. White text on a black scrim needs at least 54% for 4.5:1.

    Sources: WCAG 2.2, 1.4.3 (full text) · Failure F83 (informative, full text)

  • Convention

    Place text only where the scrim fully covers the image, usually in the lower part. With a gradient, the opacity counts at every spot with text, not on average.

    Sources: NN/g, text over images (full text)

  • Convention

    Check against the least favorable image of the series, not the sample image: the brightest behind light text, the darkest behind dark text. A scrim that works on one image often fails on the next.

    Sources: NN/g, text over images (full text)

  • Standard

    Give links and buttons on images a two-color focus ring of a light and a dark color, for example white inside and black outside with 21.00:1 between them. According to technique C40, at least one of the two colors then reaches 3:1 on any solid background. Over a photo this does not replace checking the spots behind the ring.

    Sources: WCAG 2.2, 2.4.7 (full text) · WCAG 2.2, 1.4.11 (full text) · Technique C40 (informative, full text)

Explained briefly

Text on photos: the scrim Standard

A scrim is a semi-transparent layer between photo and text. How dense it must be depends on the least favorable spot in the image. Failure F83 of WCAG 2.2 checks light text against the lightest area and dark text against the darkest. For any photo, the worst case is a pure white or a pure black pixel.

White text on a black scrim therefore needs at least 42% for large text (3:1), 54% for normal text (4.5:1) and 66% for 7:1. The page always rounds up.

With a gradient, the value applies at every spot with text, not on average.

More about this →

What the contrast ratio measures Standard

The contrast ratio compares the lightness of two colors, more precisely their relative luminance. It ranges from identical colors up to 21:1 for black on white. WCAG 2.2 requires at least 4.5:1 for text and at least 3:1 for large text.

The threshold applies without rounding. Gray #777777 on white reaches 4.47:1 and so misses 4.5:1, even if a rounded display suggests otherwise. That is why this site truncates every contrast value instead of rounding it. The formula knows only luminance: a strong red and a gray of the same luminance have the same contrast against white.

More about this →

Same color, different impression Research well supported

The same color looks different against a different ground. In 1839 Chevreul described the law of simultaneous contrast: two colors side by side look as different as possible, in hue and in lightness. In 1963 Albers showed with color studies how relative color is. A 2008 review confirms that the surroundings strongly shape how a surface looks.

In the demo, two identical gray squares sit on orange and on blue. On orange the gray looks rather bluish, on blue rather orange-tinged. The bridge shows that both squares have the same color.

That is why every pattern on this site has its own fixed ground. Always check your colors on the ground they will stand on later.

More about this →

Next

Values calculated at build time on October 31, 2026. Sources last retrieved on October 11, 2026.