FIELDNOTES / GUIDE

How to Test Placeholder Text Contrast

In this guide
AI-generated illustration; not taken on location · Illustrated comparison of placeholder text against light and dark backgrounds
AI-generated illustration; not taken on location · A conceptual comparison of placeholder text and field backgrounds.AI-generated illustration

To test placeholder text contrast, compare the text color as it appears on screen with the background directly behind the letters. Enter the effective colors into a contrast checker, then compare its result with the text contrast target that applies to your situation.

The important word is effective: a color specified in a style may look different once transparency and underlying layers are involved. Start with the field in the state you want to assess, record what you find, and repeat the check when the field’s appearance changes. The steps below will help you make the comparison and decide what to adjust if it falls short.

Find the placeholder and its background

Begin with an empty field where the placeholder is visible. Look at the field in the theme and interaction state you want to check. If the placeholder disappears when the field is focused, inspect it while it is visible first, then check any other relevant state separately.

Open your browser’s developer tools and use its element-selection control to select the field. Look for the placeholder’s styles, including its color, opacity, font size, and font weight. Depending on the browser, placeholder-specific styles may appear under a pseudo-element or in a separate part of the styles panel. If the values are inherited or overridden, use the computed styles view, if available, to see which values apply in the current state.

Now identify the background immediately behind the letters. Check the field’s background and any layers beneath it that could show through. A surrounding page color alone is not enough if the field has its own background. Conversely, a transparent field may make the surrounding layers relevant to the result.

Make a small test record

Write down the field, theme, and state alongside the visible placeholder and background values. Also note the text size and weight: you will need them when choosing the applicable target. If the design has light and dark themes, or changes on hover or focus, make a separate record for each relevant appearance. This makes it easier to trace a failing result to the particular combination that produced it.

If you cannot find a value, use the browser’s help for its inspection tools or ask someone who can inspect the field’s styles. Keep the field empty during this investigation so you are checking the placeholder rather than entered text.

Account for transparency

Before entering colors into a checker, ask whether the specified values describe what is actually visible. Transparency in the placeholder text, the field background, or an element containing the field can affect the final appearance. There may also be more than one background layer to consider.

For example, imagine a placeholder with a partially transparent text color over a partially transparent field. The field’s visible background depends on what sits beneath it, while the text’s visible appearance depends on the background behind the letters. Recording only the text’s declared color and the field’s declared color could therefore give you the wrong pair to compare.

Work from the visible combination

Inspect the relevant color and opacity settings for the placeholder, the field, and any containing elements that affect their appearance. Trace the background layers until you can identify what contributes to the area behind the text. If the inspection tools show a resolved or effective color, verify what that value represents before using it: a displayed color value may still include transparency or may describe only one layer.

A checker or color tool may be able to account for transparency, but confirm its supported inputs and how it handles layers before relying on the output. If it needs opaque colors, use a method that resolves the complete visible combination first. If you cannot verify how a tool handles a partially transparent parent or multiple layers, ask a developer or accessibility specialist to help calculate or measure the effective colors.

If the background varies across the text, such as over a gradient or image, one background color may not represent the whole placeholder. Check the combinations behind the letters in the different areas, including the least favorable area you can identify. Record how you obtained each color so another person can repeat the check.

Check the contrast ratio

Once you have an effective foreground and background for one appearance, open a contrast checker and inspect its input options. Enter the effective placeholder color as the foreground and the effective color behind it as the background, using a format the checker accepts. Run the check and record the returned ratio alongside the field and state you tested.

Check the tool’s instructions before entering transparent values. Does it accept them? If so, what background does it use to resolve them, and can it represent all the layers affecting your field? If those answers are unclear, do not assume that entering a partially transparent color will reproduce the on-screen result. Resolve the colors with a suitable method first, or seek help verifying the calculation.

Check each meaningful combination

Use a separate entry in your notes for each relevant theme, state, or background area. For a field with a changing background, compare the placeholder against the effective background in each area you need to assess. If the placeholder color also changes, capture the corresponding text and background as a pair; do not mix values from different states.

A useful record might say: “Empty search field, dark theme, placeholder visible; foreground and background values recorded; ratio returned.” Add the actual values and ratio from your own check. If you repeat the test after an adjustment, keep both results so you can see which change affected which appearance.

A ratio is a measurement to compare with a target, not a decision by itself. Confirm the applicable target before marking the result as passing or failing. If the checker supplies a verdict, check which target and assumptions it used.

Choose the applicable target

The target to compare against depends on the requirements you are using, including the relevant text size and conformance level. Use the placeholder’s actual rendered size and weight from your inspection, and confirm how those measurements are treated by the standard or policy that applies to your check. Do not assume a target based on how large or bold the text looks to you.

For an official starting point, consult Making Color Usage Accessible. Verify the applicable criteria and any interpretation needed for your situation before making a conformance claim. If your organization has specified a conformance level, check that requirement too; if it has not, ask the person responsible for accessibility which target to use.

Compare the result without rounding it up

Write the chosen target next to the ratio returned by the checker. A result just below the required threshold does not pass that threshold. If a tool displays a rounded number or a simple pass/fail label, check whether it provides enough precision and whether its verdict uses the same target you selected. When the display leaves a borderline result uncertain, use a more precise result or seek verification before treating it as a pass.

Apply the same process to every relevant combination in your notes. A satisfactory result in one theme does not establish the result for another theme or a different field state. Equally, if the background changes behind the text, the target comparison needs to cover the areas you assessed. Keep the measurements and the target together so the decision remains understandable when the design is reviewed later.

Adjust and check again

If a combination falls short, consider changing the placeholder color, the field background, or both. The useful change is one that improves the effective combination behind the visible letters. If transparency is involved, changing opacity may also affect the result, so recalculate the effective colors after any adjustment rather than relying on the original values.

Make one change at a time when practical. For example, record the original result, choose a revised placeholder color, and check it against the same effective background. If the result still falls short, consider another text color or a change to the field background, then test the new pair. Keep the chosen target beside each result so you can tell when the measured combination meets it.

Review the field in context

Repeat the inspection and contrast check for the relevant themes and interaction states. A change that helps one combination may affect another differently, especially where colors or background layers change. Recheck any varying background across the area behind the placeholder as well.

Look at the field in context after the numerical check. Can you distinguish the placeholder from its surroundings in the states you intend to use? If the design changes on hover or focus, confirm what is visible in each state and test the applicable text and background pair. A visual review can help you notice a missed state or layer; use the measured ratio and applicable target for the contrast decision.

Finish by recording the final effective colors, the ratio, the target, and the theme and state for each check. If you cannot change the design yourself, share that record with the person who can. It gives them a specific combination to adjust and a repeatable way to verify the result.

Sources

← Return to the tools