Safari's Adaptive Dark Mode: declare your color scheme
A site with a white background, dark text and no dark theme has always looked the same in Safari at midnight as at noon. In Safari 27.3 beta it may not. WebKit announced Adaptive Dark Mode on 3 November 2026 (checked 27 November 2026): “When enabled by a user, Safari adapts light websites and presents them as dark.”
If your site has no dark theme, Safari will now make one for those users. You get a say in it, and it takes one line in the <head>.
If you already ship a dark theme, say so:
<meta name="color-scheme" content="light dark">
If your site is light on purpose and should stay that way:
<meta name="color-scheme" content="light only">
If you do neither, Safari decides.
How Safari decides
According to the WebKit post, Safari analyses the page’s colours and estimates whether it is mostly light or mostly dark. A page that is already dark, with light text, is left alone. For the rest: “When a page has a light appearance, Adaptive Dark Mode adapts the page to be dark.”
The user has to turn it on. With the system appearance set to dark, Safari offers a preview on a bright site, and the user chooses to try it.
A site that declares dark support is not touched. The post names two declarations, the meta tag above and its CSS form:
:root { color-scheme: light dark }
For a site with either one, “Adaptive Dark Mode does not change a thing.”
Read that list again if your dark theme lives in a prefers-color-scheme media query. The post mentions @media (prefers-color-scheme: dark), light-dark() and <picture> sources later, as the technology for building a dark mode. It does not say that any of them, alone, counts as the declaration. A dark theme with no color-scheme line is relying on Safari’s colour analysis to notice it.
The declaration does a second job anyway. It tells the browser to draw its own parts in the matching scheme. MDN’s color-scheme page (checked November 2026) lists the canvas surface, scrollbars, form controls and spellcheck underlines.
Put it in the HTML, not in JavaScript
The WebKit post is direct about where the declaration goes: in the HTML head, or in CSS on :root or body. “Don’t wait to inject this information later via JavaScript.”
WebKit’s stated reason is speed: declaring it this way “helps ensure your site is rendered correctly as fast as possible.” A site that sets its theme from a script after load is doing the thing the post asks you not to do.
MDN gives a second reason for the meta tag. It should sit in the <head> “before any CSS style information, to inform user agents about the preferred color scheme, helping prevent unwanted screen flashes during the page load”.
Opting out, for a page or for one element
The opt-out is the only keyword. MDN’s definition: “Forbids the user agent from overriding the color scheme for the element.”
For the whole page, use the meta tag above or the CSS form:
:root { color-scheme: light only }
The CSS property also works on a single element, so you can let Safari darken the page and protect one part of it, such as a product photo grid or a chart with its own colours. The WebKit post describes the CSS rule as “allowing you to just target specific elements on the page”.
- “Support for the ‘only’ keyword arrived in Safari 27.3 beta 2.” Test the opt-out on beta 2 or later.
- The same keyword is the documented off switch for Chrome. MDN says it “Can be used to turn off color overrides caused by Chrome’s Auto Dark Theme”, and writes it as
color-scheme: only light.
What gets changed and what does not
From the WebKit post, for a page Safari does adapt:
- Colours have their luminosity inverted while the hue is kept, and text is adjusted to aim for the WCAG 4.5:1 contrast ratio.
- CSS gradients: “Light CSS gradients are also transformed to dark.”
- Images: “Most are left unchanged, preserving their integrity.” Safari inspects SVG and transforms colours where needed, and it inverts simple black-and-white bitmap logos.
- Canvas is left alone, “since canvases contain a wide range of content that’s hard to predict.”
- Masks and
mix-blend-modecan look wrong on a transformed element, so Safari sometimes switches those effects off. - Your JavaScript that reads CSS colours gets the authored values, not the adapted ones.
That list tells you where to look for damage: a photo with a white background baked in, a chart drawn on canvas with dark ink, a tiled background image. WebKit’s advice is to use SVG for logos, give content images transparent backgrounds, and prefer CSS colours and gradients to background images.
What to do this week
Nothing was run for this post, and Safari 27.3 was still in beta when it was checked. Everything above is from the WebKit post and MDN.
- Open your base layout and look for
<meta name="color-scheme">. - If you have a dark theme, add
content="light dark", even if the theme already works. If it is still dark-mode colour overrides inside a media query, the Modern Web Guidance legacy scan flags that pattern and points at the replacement. - If you have no dark theme, decide:
light only, or let Safari adapt the page and check the images, canvas and blend modes listed above in 27.3 beta 2 or later. - If your theme switch runs in JavaScript, move the declaration into the server-rendered HTML.
If Safari adapts your site badly, the post’s Feedback section gives site owners an address to write to.
Comments