Menu

Declare your color schemes before the first paint (Web HIG tip #17)
📰

Declare your color schemes before the first paint (Web HIG tip #17)

DEV Community: html·FrozonFreak·3 days ago
#CL0CaRou
#devto2#devto#dev#dark#light
Reading 0:00
15s threshold

You open example.com on a phone that prefers dark mode. The page was authored as light, with no color-scheme in the head or the first CSS. In the Safari 27.3 beta, with Adaptive Dark Mode turned on, Safari can repaint that light page as dark: colors and light gradients change, some SVG images and simple logos recolor, and some masks or blend effects can be turned off. Scripts that read the page's colors still get the authored values. The page never told the browser which schemes it supports.

Web HIG tip #17 (Quick #64): Dark mode must re-verify contrast for every semantic token combination used. Declare supported color schemes in the document head or the initial CSS, before JavaScript. light dark is the usual declaration when both schemes are supported. light only is a narrow opt-out, not the default.

Why it matters

A missing declaration leaves the browser free to invent an appearance you did not author:

Safari Adaptive Dark Mode may transform a light page that does not declare schemes.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.