designwithfocus

Color pairing & combinations

What Color Goes with Gray? Palettes, HEX and Contrast

By Design With Focus Team 6 min read
Six small swatches of gray paired with navy, teal, and warm neutrals

Short answer

Gray goes with black, white, navy, and teal when you use CSS named colors and check contrast. CSS Color Level 4 maps gray and grey to #808080. White on that gray is about 3.95:1, short of 4.5:1 for normal text. Black on the same gray is about 5.32:1.

Last verified against the sources listed below.

Key takeaways

  • CSS Color Module Level 4 sets gray and grey to the same sRGB value, #808080.
  • The 16 original names include black, white, silver, navy, teal, and gray.
  • WCAG 2.2 asks for 4.5:1 on normal text and 3:1 on large text.
  • White on #808080 is about 3.95:1. Black on #808080 is about 5.32:1.
  • The spec notes that darkgray (#a9a9a9) is lighter than gray, so the names are not a scale.

What color goes with gray? Pair the CSS color named gray, which is #808080, with a darker ink or a clearly different hue, then check the contrast instead of trusting the color name.

People also ask what color goes with grey. In CSS, grey is the same keyword. The hex values below come from the named-color table in CSS Color Module Level 4, a Candidate Recommendation Draft dated 1 December 2026.

How those grays are mixed in the first place is covered in what colors make gray.

Which grays does CSS name?

CSS defines gray as #808080, and several other keywords are grays with different lightness.

The module says named colors resolve to sRGB and that the keywords are ASCII case-insensitive. Sixteen of them came from the VGA palette and then HTML: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. MDN lists the same basic hex values.

Keyword Hex Decimal RGB
white #ffffff 255 255 255
whitesmoke #f5f5f5 245 245 245
gainsboro #dcdcdc 220 220 220
lightgray, lightgrey #d3d3d3 211 211 211
silver #c0c0c0 192 192 192
darkgray, darkgrey #a9a9a9 169 169 169
gray, grey #808080 128 128 128
dimgray, dimgrey #696969 105 105 105
black #000000 0 0 0

The spec notes that darkgray is lighter than gray. Read the table, not the adjective.

The CSSWG editor’s draft, also dated 1 December 2026, lists gray and grey as #808080 as well.

What are six palettes that use gray?

Each palette below is a set of CSS named colors. The hex is the spec value, not a tint invented for this page.

Paper and ink. whitesmoke #f5f5f5, lightgray #d3d3d3, gray #808080, dimgray #696969, black #000000. Black text on whitesmoke is about 19.26:1.

Navy office. white #ffffff, silver #c0c0c0, gray #808080, navy #000080. White on navy is about 16.01:1. Use navy for links or headings, and keep body text off the mid gray.

Teal bar. white #ffffff, gainsboro #dcdcdc, gray #808080, teal #008080, darkslategray #2f4f4f. White on teal is about 4.77:1. White on darkslategray is about 8.93:1.

Warm linen. linen #faf0e6, tan #d2b48c, gray #808080, maroon #800000. Maroon on linen is about 9.74:1. Gray here is a rule or an icon, not the paragraph color.

Midnight UI. ghostwhite #f8f8ff, lightsteelblue #b0c4de, slategray #708090, midnightblue #191970, white #ffffff. White on midnightblue is about 14.85:1. White on slategray is only about 4.05:1, so that pair fits large text better than body text.

Olive field. ivory #fffff0, gray #808080, darkolivegreen #556b2f, white #ffffff. White on darkolivegreen is about 5.95:1. A monochromatic scheme would stay inside one hue.

These rows do not. They put one gray next to one named accent.

Does gray text pass WCAG?

White on #808080 is about 3.95:1, so it fails the normal-text minimum and passes the large-text minimum.

WCAG 2.2, a W3C Recommendation dated 12 December 2024, says text and images of text need a contrast ratio of at least 4.5:1. Large-scale text can be 3:1. The guidelines define large-scale text as at least 18 point, or 14 point bold.

Logos and inactive or decorative text are excepted. Contrast (Enhanced), Level AAA, asks for 7:1, or 4.5:1 for large text.

The ratio is (L1 + 0.05) / (L2 + 0.05), with relative luminance for sRGB. For a channel, divide the 8-bit value by 255. If that is at or below 0.04045, divide by 12.92.

Otherwise add 0.055, divide by 1.055, and raise to 2.4. Luminance is 0.2126 R + 0.7152 G + 0.0722 B.

Using that formula on the named colors:

  • White #ffffff on gray #808080 is about 3.95:1.
  • Black #000000 on gray #808080 is about 5.32:1.
  • White on dimgray #696969 is about 5.49:1.
  • Black on lightgray #d3d3d3 is about 14.03:1.

So a gray button can carry white text when the gray is dimgray, and it should carry black text, or no body text, when the gray is #808080. Decorative gray dividers have no contrast requirement under the incidental exception.

How do you apply a palette?

Pick one gray for surfaces, one dark color for text, and one accent, then write the hex into the stylesheet.

A page can use whitesmoke as the page background, white as the card, and black as the text. Gray #808080 can be a border or a disabled icon. Navy or teal can mark the one action you want people to find.

That is a small set, which is easier to check than a long ramp of unnamed grays.

CSS accepts both the keyword and the hex. Prefer the hex in a design token if a teammate might think darkgray is the darker one. The HTML living standard, last updated 2 December 2026, treats documents as a tree of elements and text.

Contrast applies to that text, not to the keyword you typed.

If you want a blend rather than a flat pair, a gradient can run from whitesmoke to silver. Keep the text on a solid patch that still meets 4.5:1. A gradient behind a paragraph makes the ratio change across the line, and WCAG says you measure the specified background the text actually sits on.

What should you avoid?

Do not treat the word gray as a promise about mood, and do not build a scale from the keyword names.

The color module says the names are standardized because implementations already used them, not because the set is evenly spaced. It also says their use is not encouraged. Nothing on the WCAG or CSS pages opened here claims that gray increases trust.

Skip that kind of line.

Check the pair you will actually ship. A navy heading on whitesmoke, a black paragraph on white, and a teal button with white text are all in the tables above, with ratios you can recompute from the same formula. If the brand gray is not #808080, it is a different color, and these ratios do not apply to it.

Frequently asked questions

Are gray and grey the same color in CSS?

Yes. CSS Color Module Level 4 lists gray and grey as the same sRGB color, #808080, which is 128 128 128. MDN's named-color page says the same thing and lists grey as a synonym of gray. Keywords are ASCII case-insensitive, so Gray, GRAY, and grey resolve together. The other gray pairs work the same way: darkgray and darkgrey are both #a9a9a9, dimgray and dimgrey are both #696969, and lightgray and lightgrey are both #d3d3d3. Spelling changes the letters, not the hex.

Can I put body text in CSS gray on white?

Not if you are meeting WCAG 2.2 for normal text. The contrast formula in that recommendation, applied to white #ffffff and gray #808080, comes out to about 3.95:1. Success Criterion 1.4.3 asks for at least 4.5:1, with a 3:1 exception for large-scale text. Large-scale text is at least 18 point, or 14 point bold. Gray on white can serve that larger type and still miss body copy.

Why is darkgray lighter than gray?

Because the names were inherited, not designed as a ramp. CSS Color Level 4 says 16 names came from the VGA palette and most of the rest from an X11 set. The spec's own note says the names are not internally consistent, and it gives darkgray being lighter than gray as the example. The hex values match that note: darkgray is #a9a9a9 and gray is #808080. The same note says the names are standardized because they are widely implemented, and that their use is not encouraged.

Which named colors sit next to gray in these palettes?

The six palettes below use only keywords from the CSS named-color table. Neutrals include white #ffffff, black #000000, whitesmoke #f5f5f5, silver #c0c0c0, gainsboro #dcdcdc, and dimgray #696969. Accent names include navy #000080, teal #008080, midnightblue #191970, maroon #800000, and darkolivegreen #556b2f. MDN lists the same hex values. If a screen shows a different gray, it is not the CSS keyword gray.

Do these ratios assume sRGB?

Yes. WCAG 2.2 defines relative luminance for the sRGB colorspace and says authors should evaluate with sRGB unless they know another color space is in use. CSS Color Level 4 says the named colors resolve to sRGB. The ratios in this guide use that luminance formula on the 8-bit channels from the named-color table. They are not a measurement of a particular monitor, and they ignore anti-aliasing, which WCAG says you can turn off when you evaluate text contrast.

Sources