Wednesday, November 4, 2026

Safari 27.3: Adaptive Dark Mode

Simon Fraser et al. (Hacker News):

When enabled by a user, Safari adapts light websites and presents them as dark.

[…]

At the core of Adaptive Dark Mode is the transformation of color. Sometimes colors are simply decorative, while other times they have semantic meaning. Adaptive Dark Mode determines when to invert colors so elements remain visible or when to leave colors unchanged.

While creating Adaptive Dark Mode, we developed a color matrix to invert the luminosity of colors while preserving hue. It’s used to make light backgrounds dark, and dark text light. When transforming text color, Adaptive Dark Mode aims for sufficient contrast as defined by the WCAG 4.5:1 contrast ratio. Light CSS gradients are also transformed to dark.

[…]

It takes the same care with images. Most are left unchanged, preserving their integrity. But many icons and logos can lose contrast when the background color behind them is inverted. So Adaptive Dark Mode inspects SVG images and transforms colors when needed. For bitmap images, it analyzes the pixel histograms and inverts simple black-and-white logos.

See also: NSTextView.usesAdaptiveColorMappingForDarkAppearance (WWDC 2019).

Federico Viticci:

If this sounds familiar, it’s because so many third-party Safari extensions for this very task already exist, including the very popular (and a MacStories favorite) Noir.

Previously:

1 Comment RSS · Twitter · Mastodon


They should use this in mail, instead of showing bright white mails over dark background.

Leave a Comment