How to Stop Safari’s Adaptive Dark Mode From Recoloring Your Site

You shipped a light site. A reader on the Safari 27.3 beta opens it with Dark appearance on, and the page comes back in colors you did not write.

That is Adaptive Dark Mode, announced by WebKit. When the reader turns it on, Safari recolors light pages. Sites that already say they support both schemes are left alone.

You do not need a new framework for this. You need one declaration, and a look at logos and backgrounds. Let’s get started.

Safari Adaptive Dark Mode on a light site
Image: WebKit

What You Need First

A site you can edit, and Safari 27.3 beta if you want to see the preview yourself. WebKit’s post says the feature is in that beta, not in a finished Safari release as of the announcement.

WebKit’s numbers, from that same post: almost 40% of page loads are from people in dark mode, and only 10% of page loads support it. If your site is in the second group, Safari may now invent the dark version.

If you are already using newer CSS and you want the longer list of what is safe to ship, this roundup of modern CSS features is a good companion. Adaptive Dark Mode is a browser behavior on top of that, not a new property you author for effect.

See What Safari Does

Set the Mac’s appearance to Dark. Open a site with a bright background in Safari 27.3 beta. WebKit says Safari offers a preview. Tap Try.

Safari looks at the colors and guesses whether the page is mostly light or mostly dark, so a page that is already dark text on a dark background is left as it is, and a light page gets adapted.

The adaptation is a color matrix, which flips luminosity and keeps hue, so text is pushed toward a 4.5:1 contrast ratio and light CSS gradients are darkened too.

Most images stay as they are, but SVG icons can be recolored, and simple black-and-white bitmap logos can be inverted because a black mark on a background that just turned dark would disappear. canvas is left alone, and masks and mix-blend-mode are sometimes turned off, because they look wrong after the colors move.

Tell Safari You Already Have a Dark Mode

If the page signals both schemes, Adaptive Dark Mode does not change it. WebKit is specific. Either of these is enough for the whole page:

<meta name="color-scheme" content="light dark">
:root {
  color-scheme: light dark;
}

Put the meta tag in the document head, or set color-scheme on :root or body in CSS. Do not add it later with JavaScript. WebKit says the early declaration is what lets the browser paint the right scheme on the first frame.

Then write the dark styles yourself, usually inside @media (prefers-color-scheme: dark). You can also scope color-scheme: light dark to one element if only part of the page should opt in.

Custom properties make that split easier to keep straight. This intro to CSS variables covers the basic pattern, and the @property rule is there if you need typed tokens that can animate.

Opt Out If You Want the Light Page Left Alone

Some pages should stay light. A design tool, a print preview, a brand page with a fixed palette. WebKit added an opt-out.

<meta name="color-scheme" content="light only">
:root {
  color-scheme: light only;
}

That says the page supports light mode and should only be shown in light mode. The CSS form can target one element, or the whole page from :root. Support for the only keyword arrived in Safari 27.3 beta 2, so beta 1 will not honor it.

Fix the Pieces That Still Look Wrong

If you let Safari adapt the page, WebKit’s own list of trouble spots is short.

  • Swap bitmap logos and icons for SVG.
  • Use CSS colors or gradients instead of a tiled background image.
  • Drop image sprites for corners, shadows, and button states.
  • Give content photos a transparent background, so the page color is not baked into the file.
  • Add padding so inverted text does not sit on the edge of a box.

You cannot detect that Adaptive Dark Mode is on. WebKit blocks that on purpose, so a site cannot fingerprint the reader. JavaScript that reads computed colors gets the colors you authored, not the adapted ones. A picture drawn into a canvas stays in its original colors.

Container queries will not tell you about this either. They answer a different question, which this container queries guide already covers.

Check That It Stuck

In Safari 27.3 beta, with Dark appearance on, load the page twice. Once with no color-scheme declaration, once with light dark or light only.

With light dark and real dark styles, you should see your styles, not Safari’s matrix. With light only on beta 2 or later, the light page should stay light. With neither, a bright page can be recolored.

If a logo vanishes or a blend mode goes muddy, fix that asset. Do not wait for a script to notice the adaptation. It will not.

WebsiteFacebookTwitterInstagramPinterestLinkedInGoogle+YoutubeRedditDribbbleBehanceGithubCodePenWhatsappEmail