freesozoFree tools, no sign-up (home)
All tools
Language: English
Tool number 13

Color Scheme and Contrast Checker

Enter base, main, accent and text colours to see them on sample website and app layouts. Contrast ratios tell you whether each combination keeps text readable.

    The results look only at the difference in lightness between colours, so treat them as a guide. How readable text really is also depends on its size and weight and on the screen brightness.

    Colours

    Try other colour vision

    What to do next

    The three colour roles

    • Base: the colour of the background and margins. It covers the largest area.
    • Main: the colour that gives the site or document its identity. It's used for the logo, header bands and main buttons.
    • Accent: for the few places you really want people to look, such as a sign-up button or a "New" badge.

    This tool also takes a text colour. Colour schemes are often talked about in threes, but what decides whether text can be read is how the text and the background pair up.

    A split of "70% base, 25% main, 5% accent" is often quoted as a guide. Its original source couldn't be confirmed, though, so this tool doesn't impose it. Instead it counts how much of the sample each colour actually covers and shows that below the drawing. When you use more accent, check in the sample that the places you want to stand out still do.

    What a contrast ratio is

    It expresses the difference in lightness between two colours as a number from 1 to 21. A colour against itself is 1, and white against black is 21. WCAG 2.2, the international guideline for web accessibility, sets out how to calculate it and the standards for readability.

    Contrast ratio = (luminance of the lighter + 0.05) ÷ (luminance of the darker + 0.05)Luminance is a lightness from 0 to 1, worked out from the strength of red, green and blue. Green counts the most and blue the least.

    Here's what happens with grey text on white (luminance 1).

    Text colourLuminanceRatio to whiteAs body text
    #000000021:1Readable
    #5959590.17:1Readable
    #7676760.1814.54:1Readable
    #7777770.1844.47:1Not enough
    #9494940.2963.03:1Not enough
    #cccccc0.6041.6:1Not enough

    #767676 and #777777 look almost identical, but they fall on either side of the 4.5:1 line. That's why this tool cuts the ratio off at two decimals rather than rounding it.

    The standards

    Used forRatio neededWCAG 2.2 criterion
    Text at normal size4.5:11.4.3 Contrast (Minimum), Level AA
    Large text3:1Same as above
    Things that aren't text, such as button outlines, icons and charts3:11.4.11 Non-text Contrast, Level AA
    Text at normal size (stricter standard)7:11.4.6 Contrast (Enhanced), Level AAA

    "Large text" means at least 18 points, or at least 14 points in bold. For scripts such as Japanese, an equivalent size is meant.

    The five pairs this tool checks

    Only the pairs actually layered on each other in the sample are checked.

    1. Text on base: body text. 4.5:1 or more.
    2. Main on base: links and headings written in the main colour. 4.5:1 or more. Bright main colours, such as yellow, fall short here. Then it's more practical to use the main colour only for filled areas, not for text.
    3. Accent on base: whether button and badge fills can be told apart from the background. 3:1 or more.
    4. Text on main-colour fills: text inside buttons and bands. 4.5:1 or more.
    5. Text on accent-colour fills: also 4.5:1 or more.

    The colour of text on filled areas is picked automatically from white, the text colour and the base colour, whichever gives the highest ratio. The one picked appears in the "Pair" column of the table.

    How a failing pair gets fixed

    Pressing the button in the table keeps the hue and saturation, moves only the lightness, and switches to the nearest colour that meets the standard. When no lightness can get there (for example, against a colour of middling lightness), the other colour in the pair needs to change instead.

    Trying other colour vision

    People are born with different types of colour vision. According to Fukushima Prefecture's colour universal design guide, the most common type, called type C in Japan, accounts for about 95% of Japanese men and over 99% of women. The next most common are types D and P, which make red and green hard to tell apart.

    The names type C, P, D and T were proposed by the Japanese NPO Color Universal Design Organization. In medical terms, type P is protan (first type) colour vision and type D is deutan (second type). This tool uses the English terms protan, deutan and tritan.

    "Try other colour vision" recalculates the colours of the whole sample to show how hard they are to tell apart. It uses the conversion matrices (at severity 1.0) published by Machado and colleagues in 2009. As Sapporo City's guidelines also point out, conversions like this reproduce how hard colours are to distinguish, not the colours the person actually sees.

    "Greyscale" removes colour and leaves only lightness. Whatever someone's colour vision, a scheme with differences in lightness is easier to tell apart. If the buttons and text still read in greyscale, that's a good sign.

    Common mistakes

    • Light grey text: it looks stylish, but #999999 on white is 2.84:1, which isn't enough for body text. Even small supporting text should reach 4.5:1.
    • Using a brand colour as is for text: bright colours can work for filled areas but not for text. Prepare one darker colour of the same hue for text.
    • Giving meaning through colour alone: marking required items only in red doesn't come across to people with protan or deutan vision. Add text or a symbol.
    • Putting accents everywhere: the more places stand out, the less any of them do.
    • Deciding on one screen only: a monitor in a bright room and a phone outdoors look different. Check schemes that only just pass on real devices too.

    FAQ

    Are the colours I enter sent anywhere?
    No. The calculations and the sample drawings all happen inside your browser. The colours you enter are saved only in your browser.
    What is "Copy a link to this scheme"?
    It's a URL with the four colours added to the end. Opening it opens this page with the same scheme filled in, which is handy for showing a scheme to someone. Only the colour values go into the URL.
    Is 4.5:1 always readable?
    Not always. The contrast ratio only looks at the difference in lightness, not at how thin or small the text is or how well the colours go together. Give thin typefaces and small text some extra margin.
    Does a logo need 4.5:1 too?
    WCAG 2.2 excludes text that is part of a logo or brand name from the contrast criteria. This tool's results are meant for body text and text on buttons.
    How can I enter colours?
    It reads #1d3557, #abc, rgb(29, 53, 87), hsl(215 50% 23%), and plain numbers like "29, 53, 87". When you leave the field, the colour is rewritten as #rrggbb.
    Are the sample text and the shop real?
    No. They're made up so you can look at the colours.

    Sources

    More tools