
| Point | Value (ratio to one) |
|---|---|
| L=0.05 | 10.5 |
| L=0.10 | 7 |
| L=0.15 | 5.25 |
| L=0.20 | 4.2 |
Illustrative calculation (not sourced observations). WCAG formula (1.00 + 0.05)/(background relative luminance + 0.05); hypothetical evenly colored samples, not field measurements.
A photograph has no single background color. That sounds obvious until a caption is approved against the dark leaves on an editor's wide monitor and then appears across pale blossoms on a phone. The caption itself has not changed. Its white color token still has the same name, and the image still has the same filename. But the background that matters is the one immediately behind the words in the version the reader actually sees. Moving from that observation to a testable publishing rule is the useful part of a contrast audit.
Consider a fictional orchard story. The photo shows someone kneeling between rows, looking down at an early blossom. The editor needs readers to know that the photo shows a monitoring visit, not a harvest. The first caption proposal puts that sentence in white at the bottom of the frame. The bottom left of the desktop crop looks like dark garden soil. When the narrower crop centers the person, an irrigation marker and a band of white petals move under the caption. At the same time, the sentence wraps into two lines. A correction must work for the new geometry, not just return the original image to a condition that looked good in a slide deck.
The examples in this article are synthetic. They are meant for reasoning about a component, not evidence that a real orchard photograph was measured or that a live site meets any accessibility standard. The goal is to leave an editor and an engineer with a shared decision: which layouts guarantee their text pair, which require review at release, and which should put words outside the image entirely.
Define what has to stay readable
Start by identifying the job the caption performs. A caption that supplies a date, place, warning, context or credit is still content even when it occupies a quiet corner. The fact that a design treats something as secondary does not make its words decorative. The orchard caption might prevent a genuine misunderstanding: the branch looks ready for fruit to a reader who does not know what the photograph depicts. A caption can also distinguish an editorial illustration from documentary evidence. Losing that statement on mobile changes the interpretation of the page, even if the first paragraph of the article survives.
Break the visible lines down into color roles before sampling anything. The component may use white for the sentence, a pale tan for the credit, and a softer white for the control that lets a visitor see a larger image. A pass for the sentence is no proof for those other roles, even if they use the same strip. If an interactive item has a distinct hover, keyboard focus, selected or pressed state, list each state in the fixture, and separate the text contrast result from checks about the focus indicator and other control graphics. A label disappearing against a photo and a focus outline disappearing beside it may have related causes, but they are not the same measurement or automatically the same criterion.
Capture the minimum approved typography rather than the most flattering headline version. In WCAG 2.2, the Level AA minimum for ordinary text under success criterion 1.4.3 is 4.5 to 1, and the minimum for text meeting its large-scale definition is 3 to 1. The large-scale definition is not whatever a design system named large. Its examples use 18 point text or 14 point bold, with equivalent sizing considered for relevant fonts. With conventional CSS reference units those point sizes are 24 CSS pixels and about 18.67 CSS pixels respectively. A small caption should ordinarily be evaluated at 4.5 to 1. Using a thick typeface or a big screenshot is not a substitute for determining the actual rendered typography and its role.
W3C's explanation of minimum contrast is a useful companion to the normative wording. Read the stated exceptions rather than classifying captions by intuition. A caption is generally neither incidental text in a picture with other significant visual content nor text that is part of a brand logo. Real cases can be nuanced, such as the photographed label on a specimen in a scene versus a label the publisher layered above the scene. Those are different content objects. Choosing to add the latter as part of the interface is a design decision you control.
A useful brief therefore says that all ordinary caption roles must retain a known readable pair over every allowed image variant and that uncertain combinations fall back to a defined layout. It does not say that the theme has white captions, or that white captions are fine because most images are dark. This small wording difference changes what can be checked and who owns the check.
Read the graph as color arithmetic
The graph on this page considers opaque white text over four uniform backgrounds. The chosen relative luminances are 0.05, 0.10, 0.15 and 0.20. Using the WCAG calculation, the ratios are 10.5, 7, 5.25 and 4.2 to one respectively. They are calculated points, not samples drawn from any photo. The x values are relative luminances, not opacity values, and the y values are dimensionless ratios. The segments connecting the dots guide the eye; the underlying relationship follows a reciprocal function, not a rule that each equal step in luminance subtracts an equal amount of contrast.
For any pair, put the lighter relative luminance in the numerator and the darker one in the denominator, adding 0.05 to each. With white text on a darker background the numerator is 1.05. On the background with relative luminance 0.15, the denominator is 0.20, giving 5.25 to one. On the background with relative luminance 0.20, the denominator is 0.25, giving 4.2 to one. The first three examples exceed 4.5 to one; the fourth does not. It could clear the lower numeric requirement for qualifying large text, but that is no help for a small credit printed on the same background.
To use the ratio algebraically, hold white fixed and ask how light the background can be at the minimum for ordinary text. Divide 1.05 by 4.5 and then subtract 0.05. The result is approximately 0.1833. In the white-text model, a lighter background misses the minimum. This is a useful bound for a palette exercise and a useful clue when interpreting a sampling report, but it is not a recommended design target. A ratio with no reserve leaves little room for a different text token, a faded state, or a previously untested crop. Do not round up a computed ratio to get a passing result. For example, 4.49 is below 4.5, even when a report formatted to one decimal place prints 4.5.
What counts as 0.1833 deserves care. It is not a gray slider at 18.33 percent, an sRGB channel of 18.33 percent, or a statement that the image must be reduced to one fifth of its initial brightness. Relative luminance is computed from linearized color components. A rough gray example makes the distinction plain: mid gray with encoded red, green and blue each at roughly one half of their maximum has relative luminance near 0.214, not 0.5. An editor who uses a graphic application's gray slider as a luminance ruler may approve the very pair they intended to reject.
The formula also lets you reason about changing the foreground. In an illustrative design system, the main caption is white, but the credit is changed from white to a cream swatch. The lighter color can still look white to a viewer in that layout, while having lower relative luminance. The same background that left headroom for pure white leaves less headroom for cream. That means every role has its own permissible background limit. A design system can publish one conservative limit derived from the weakest ordinary text token, but should be explicit about that choice instead of silently treating all near-white text as interchangeable.
The limitations of the chart mirror the problem in production. A real scene may include patches much lighter than the fourth point and shadows much darker than the first point, and both can sit under a single word. A chart calculated from uniform colors is valuable precisely because it isolates the arithmetic. It would be a mistake to reinterpret its four labels as four positions in a real orchard, or to read age, weather, or any other observation into the background values. Treat it as a set of calibration examples you can recreate with swatches before testing a complex component.
Work through a real token pair
Take white text, specified as hexadecimal FFFFFF, over an opaque strip with hexadecimal 242424. In an eight-bit sRGB description, each background channel is 36 out of 255, or about 0.1412 in encoded space. To get a linear component, for a normalized channel at or below 0.04045 use division by 12.92. Above that breakpoint subtract the curve offset by applying the equivalent expression in which 0.055 is added to the channel, the result divided by 1.055, and the quotient raised to the power 2.4. For this neutral gray all three linear components are approximately 0.0176. The WCAG coefficients are 0.2126 for linear red, 0.7152 for linear green and 0.0722 for linear blue; they sum to one, so neutral gray has the same numeric value for relative luminance as each of its linear components.
Dividing 1.05 by roughly 0.0676 gives about 15.5 to one for this pair. The pair has ample minimum-contrast margin without forcing the strip to be pure black. If a final design prefers a slightly greener charcoal, recompute it by channel. A vivid color cannot be treated as neutral just because its editor calls it dark green. Saturation and apparent vividness are not the input to the minimum-contrast calculation. When colors come from an authoring pipeline with different precision, compare using adequate precision and keep the canonical token, not a screenshot's rounded label, as the record of the solid pair.
Now try a muted credit token of hexadecimal A8A8A8 with the same solid background. Its channels are 168 out of 255 and its relative luminance is about 0.392. The ratio is roughly 6.5 to one. The credit passes the ordinary-text threshold on this strip, but watch what happens if the design gives it a transparent gradient area with a composite background luminance of 0.10: approximately 0.442 divided by 0.15, or 2.95 to one. The headline with opaque white is 7 to one against that same composite background. Someone who sampled only the headline would not discover the failed credit. A useful token spreadsheet puts both rows side by side with the same background and flags the different numeric results.
Prefer automated checks for solid pairs with an explicit record of expected precision. Test them using input colors and the current formula, and pin a few known cases as fixtures. Black on white is the natural upper-bound test at 21 to one; equal colors produce 1 to one. The two pairs above exercise middle values. These tests catch a frequent category error: applying the weighting coefficients to nonlinear encoded channels, or sorting encoded color numbers rather than comparing relative luminance. A helper can be tiny and still give false confidence if no one checks it against well-understood examples.
If the final design has foreground transparency, the foreground itself must be reasoned about as displayed over the relevant background; the opaque swatch table is not enough. An element-wide opacity setting is especially easy to miss because it affects text and backing together. Where the purpose of transparency is to reveal the image, apply it to a dedicated background layer and keep essential text opaque. This makes the problem simpler to analyze, and it gives test authors a meaningful question about the visible background rather than a confused mixture of text and image alpha.
Why averaging the crop fails
Suppose a photo has an almost black wall filling most of the frame and a small white banner cutting through the caption's right edge. Averaging across the whole image would rate it safely dark. Averaging across the caption area might still produce an attractive report. But the reader does not average the light of the wall into the banner and then mentally reconstruct the three letters that crossed it. On the words where the banner appears, the letters are difficult or impossible to separate from their immediate background. A low average is evidence about the mass of the frame, not evidence of sufficient local separation.
The same distinction appears one level down. A rectangular caption bounding box includes its outer padding, spaces between words and line gaps. The brightest point inside that full rectangle might be under padding, where there is no text. A simple maximum across the box is then conservative; it may reject an otherwise acceptable frame. For a component intended to survive changes in font, writing system or copy, it can still be a sensible upper-bound screening method. If a picture or treatment has to push the edge, follow that screening pass with an inspection of where the rendered glyphs actually occupy the photo. Do not invert the screening rule and declare a low average sufficient just because a maximum can be overly strict.
Consider a two-line caption with the long word at the end moved down at narrow width. In the wide frame the bright streak may run through a space and never overlap a letter. On mobile the word begins just above the bottom edge where the highlight lands. Translations create their own geometry; the problem does not vanish merely because a desktop screenshot is sharp. In a genuinely reusable template, responsive layout is a generator of new foreground-background pairs. You do not know those pairs from the color of the original exported image alone.
For ordinary opaque light text, the simple worst-case tendency is that a brighter background drives the ratio lower, as the chart demonstrates. Dark text on a light background has the opposite tendency until the background crosses it. The dangerous region is not necessarily the brightest part of the image when the text is dark, and not every image treatment keeps one member of the pair consistently lighter. Inverting a component's color scheme changes the audit. Generalize the check to the minimum computed ratio for plausible local pairs, not a rule that always seeks either the minimum or the maximum image luminance.
Image content can make a passing ratio harder to read in practice. Busy edges, fine twig patterns, tiny lettering and unusual spacing can be disruptive even if the numeric pair just passes. A neighboring branch can visually cut across the stroke pattern. A numeric test addresses a particular requirement; a reviewer still judges whether the design creates a calm place for reading. There is usually little benefit to making a caption compete with the most elaborate area of a picture. Use the photo's important subject and the words' important content as different claims on the same space.
Choose the right kind of backing
An opaque strip supplies an invariant color pair. Provided the text always fits on the strip, the photo may switch from a dark greenhouse to a reflective field without requiring a new luminance calculation. The tradeoff is compositional: the strip covers part of the image. Move it down and the band may hide an important reference line. Give it too little padding and the edge may press visually against descenders in a second line. Keep the strip sized to the text flow, rather than drawing a fixed-height rectangle sized around the approved English sentence.
A separate block below the image also supplies a stable background and can keep the whole frame visible. It makes space for detailed credits, multiline contexts, and links that need a generous interaction area. It occupies vertical space and changes the feeling of an immersive first screen, but that can be a worthwhile trade. Use a below-photo layout when caption length or image content is unknown, for highly variable contribution pipelines, or when a caption is normally read as a short paragraph. A default below-image layout can sit alongside an opt-in overlay without compromising the publication's visual identity.
A translucent backing can preserve more of the photograph while constraining the range behind the words. It still couples the foreground to the photo. The lower the opacity, the brighter a bright input region can remain. Even a black backing can be too weak if the crop includes a bright specimen card just where the caption sits. A consistent percentage is not a consistent contrast value. An opacity percentage describes one operation in the composition and is not the resulting relative luminance. Treat the chosen alpha as an implementation parameter and validate the final result under the actual rendering path.
A gradient offers softer transitions. It can be appropriate when the caption lives in a strongly shaded area and the transition occurs outside any text. The risk is that long copy climbs into a weaker band, or a rescaled hero moves the gradient and copy into a different relative position. The correct gradient question is not whether its final stop is dark. It is how weak the backing is anywhere a line might end up and whether that weak area survives the brightest allowed underlying input. A simple pattern is to include a flat strong region behind all the potential text and let the fade happen above it. It may feel like a gradient to a viewer while keeping the text area much closer to a solid-strip design.
A shadow, applied carefully, can reduce how often text blends into the scene around thin strokes. But a soft shadow that drifts away from the letter does not guarantee a uniform immediate background, and a different font can change the result. Avoid treating the presence of any shadow as a minimum-contrast proof. Dark edging that remains close to strokes is a different design from a distant decorative glow, and there are cases where such treatments can provide contrast. Even then, test what the arrangement actually does. For a system with frequent content changes, a known background is easier to specify than a delicate set of letter-by-letter effects.
Another option is to use a short label over the photograph and keep a full caption immediately below. This can work if the overlay remains meaningful and readable on its own, and if the author does not expect someone to infer the missing parts. A designer might place a compact, stable category badge above an image, while the informative caption with capture details appears in a normal figure caption below. Do not create redundant overlapping copies that are announced twice by assistive technology. Make clear which element carries the full statement and why the overlay is there at all.
Calculate a bound, then test the render
Think about a deliberately simplified composite using a linear-light model. If an opaque white pixel has relative luminance 1 and black has relative luminance 0, blending the two with a black weight of 0.80 leaves a background relative luminance of 0.20. In this model that background produces 4.2 to one with opaque white text. The number is useful because it shows why a supposedly strong value like eighty percent is not self-explanatory. It is not a prescription for CSS alpha. In compositing based on nonlinear encoded channels, blending black with white to an encoded value of 0.20 yields a different linear luminance after conversion; layers, color spaces, gradient interpolation and effects can further change the result.
For an asset-independent check, design a flat fixture that supplies the brightest plausible background and the weakest allowed treatment in the caption region. The fixture should use the same image element sizing and caption markup as the actual template. Start with white if your pipeline is bounded to ordinary sRGB and the proposed treatment simply darkens it; keep additional fixtures if images or blending modes can behave differently. For white text, confirm every relevant rendered caption area stays below a conservative luminance limit. For colored text, use the role-specific ratio, and record the actual colors returned by the test. If you change the rendering path, regenerate proof rather than assuming the old result follows automatically.
A bright test tile also catches missing fallbacks. Perhaps the background color is defined only on a class added after JavaScript loads, or a gradient is provided by an optional asset. Disable the optional layer and see what the caption becomes. The inverse test matters too: block image loading and inspect the fallback. Bright caption text placed over an inherited light surface is a genuine failure even if it can be reproduced only in a slow browsing state. If a different layer gives the intended reading surface, attach that layer to the same component contract as the running caption.
Prefer a local mock asset for this test instead of depending on an external image host. The mock can intentionally include a white patch on the left, a near-white diagonal border, a dark patch at the center, and an isolated spot under likely caption positions. You can review the whole fixture by eye, but its real value is repeatability. The next reviewer can reproduce why a short phrase passed and a long translation moved into washed-out ground. Place geometry markers in comments or in an optional debug overlay rather than baking measurements into the article image.
If the template uses responsive images, confirm the exact variant actually selected. A source image and an alternate narrow crop can use the same logical title while containing different details under the caption. A small test that checks the loaded asset, source dimensions and current caption region prevents a false pass where automation evaluates the wrong crop. Review whether a blurry placeholder can appear briefly beneath text. If the stable backing is independent, transient images may change appearance without affecting the pair; if not, they add states to the test. A fixed foreground with a moving photo is not a static contrast problem.
Counting screen pixels can help in investigations, but distinguish source colors, composite pixels behind the text, text colors before smoothing, and edge colors after smoothing. Antialiasing combines glyph edges with their surroundings, so taking the palest stroke-edge pixel as the text token can misrepresent the intended pair. W3C's understanding document discusses evaluating contrast without depending on antialiasing. In a screenshot workflow, preserve the layout and render a diagnostic capture with text paint hidden without removing its layout box. Compare that background capture to declared colors where appropriate, then inspect the original composite alongside it. This provides evidence of what lay behind the caption while avoiding the circular act of using white letters as the sample for their own background.
Set up a review that survives a release
The most useful review matrix is small enough to run during ordinary publishing. Begin with a narrow version in which copy wraps, a wide version in which the crop is different, and one intermediate width near each relevant layout switch. Use representative long copy, a short caption, credit-only content and any applied media label. Test both themes if theme changes affect tokens. Add a real editorial image with a bright patch at a caption edge, not just an averaged studio photograph. Repeat using the largest and smallest roles the markup actually allows. The point is not to enumerate every device model, but to cover the transitions that alter the possible pair.
Record enough context to reproduce a failure. A ticket that says “white caption too pale” is easy to close with a change to the wrong token. A better observation records the route, the fixture version, viewport dimensions in CSS pixels, caption role, loaded image candidate, crop rule, media-loading state, theme, lowest observed ratio, and location. One screenshot showing the failing line, and one showing the background without text paint, can remove ambiguity. If the reported ratio comes from a bounding region and includes spaces where no glyph was present, label it a conservative check rather than claiming confirmed glyph failure.
Devise labels that separate incomplete evidence from passing evidence. “Not sampled” is not a pass. “Passed solid pair” does not prove that the final text always stays inside the backing. “Passed sampled overlay” does not prove the next photograph is safe. “Fixture passed after move below image” communicates both the architectural change and why new photos no longer change the pair. A short ledger of such statuses is more useful than an oversized sheet with a single green cell for accessibility.
For a reproducible production check, evaluate failure and fallback branches intentionally. Configure one known photo that ought to keep overlay mode and one that is expected to fall back below. If both use the strip, that may be safe but not faithful to the selected design. If both use overlay without a sufficiently strong backing, a control has likely been bypassed. If a client side check determines layout, think about render timing: a problematic frame should not appear first and then move when the checker resolves. Default to the known safe layout until the optional condition is satisfied, or choose the layout before serving the component.
An editorial review should also flag a shift in meaning if copy is shortened to avoid a problem. Moving “illustration” to a fine-print credit, for example, can leave viewers believing an image is a field record. Cropping away a plant label to place text on darkness might obscure the subject of the photograph. When a layout requires such concessions, widening the design options is better than encouraging a series of smaller captions. The visual brief and the content requirement both survive when the caption can move naturally below its frame.
Treat viewport, keyboard, user zoom and text spacing as related checks rather than declaring that passing one guarantees the others. At zoom a reader may legitimately see a different layout or wider wrapping. A link may remain numerically readable but become covered by another element. An interactive caption label also has a semantic role and needs an appropriate keyboard path. Screen reader output and selectable text benefit from markup, but good markup does not excuse poor visual contrast. Keeping these checks separate makes it easier to find the right fix quickly, especially when design layers are reproduced across copy variations.
Put the rule into the component contract
The component contract might allow a solid caption strip or an adjacent caption by default, and add an audited overlay as a third option. The solid strip requires a verified token pair and padding around wrapped text. The adjacent caption uses the known page surface, has no decorative photo affecting its backing, and can be used on any image. The audited overlay requires a validated rendering treatment and an explicit fallback on unsupported variants. Document the choice in normal editorial terms, such as “keep image unobstructed” or “short label with fixed backing,” rather than leaving opacity controls as a settings puzzle.
Safe defaults save time when an archive grows. In a set of one hundred entries, there may be an early batch with short labels and a later batch with capture notes, provenance and links. The first dozen examples are a poor reason to declare that two lines will always fit. Model caption height as an outcome of content and typography. If an overlay is only safe for one line, let wrapping trigger a different layout rather than hide the extra text or reduce font size. If a curator supplies a crop with a fixed safe zone, note the specific scope of that approval and what invalidates it, including replacing the image or changing placement.
With the fictional orchard story, I would choose a solid charcoal strip or put the caption below. Both are supported by stable, reusable checks; the choice turns on whether the strip obscures an important part of the frame. The subtitle about field context should not float partly on petals and partly on soil. For a wide display where the scene silhouette is important, an adjacent caption keeps the frame safest. If the overlay look is central to the design, keep the text and strip inseparable and place any gentle fade beyond the text. The image can retain its atmosphere without making the reviewer guess how much of a highlight falls under each line.
Release decisions should identify what has actually been demonstrated. A suitable report might say that the two known text roles use a shared opaque strip, token pair arithmetic passes, and the strip contains all visible lines in particular crop and width fixtures. It can state that an image failure check preserved the backing. Such a report is much stronger than “WCAG compliant” slapped onto the entire archive after a single component review, and it is honest about the work that remains. Site conformance has a wider scope than the ratio of a caption.
Future edits should trigger the cheapest matching check. Changing only the approved solid color may require recomputing the pair and a small visual verification. Changing a crop on an unbacked overlay requires review of the rendered geometry, not just a rename in an asset list. Allowing dynamic captions over a moving scene can require a fundamentally safer approach because a single frame cannot bound playback. A robust component reduces the number of changes that alter its proof. That is good engineering even before considering the accessibility result.
Handle the difficult state before the reader reaches it
A gallery often exposes a transitional state that never appears in a single approved image. During a crossfade, an old dark photograph may disappear under a pale new crop before the caption switches. During a swipe, one caption could remain fixed while two images and the seam between them pass underneath. If the text continues to be visible through the transition, neither the first nor the last frame can answer whether it was readable throughout. An opaque backing tied to the caption, rather than tied to one image, makes that behavior much easier to validate. An adjacent caption provides the same separation if motion is more important than having words inside the scene.
Keep the relationship between caption and frame accurate as well as high contrast. A dark strip might remain perfectly readable while displaying the previous photograph's date above the new photograph's content. That defect calls for resolving which scene owns the caption, not for changing its color. A useful gallery fixture asserts both that the next caption and image pair correctly and that the backing covers the text during a slow transition, a rapid repeat gesture, and a restored route. For reduced motion, inspect the resulting direct state change separately; it should not bypass the normal caption defaults.
Finally, make a recovery path understandable to an editor. If a preview flags a bright patch behind a credit, offer a direct switch to the adjacent caption or the approved solid backing rather than demanding an arbitrary adjustment to a numeric slider. Preserve the editor's wording when the layout changes. If a later photograph offers usable negative space and the design calls for an overlay, reopen that option deliberately. The fallback is a legitimate design mode, not a failed attempt that readers need to see or publishers need to conceal.
Sources
- W3C WAI: Understanding minimum contrast. Explanation of the ratio, relative luminance, large text and applicable exceptions. The chart uses its method, not data obtained from this page.
- W3C: Web Content Accessibility Guidelines 2.2. Normative standard, including minimum text contrast and the separate scope of conformance.