We’re enthusiastic to province Adaptive Dark Mode in Safari 27.3 beta. When enabled by a user, Safari adapts ray websites and presents them as dark.
In the fountain of 2019, Safari 12.1 became the archetypal browser to assistance dreary manner on the web. A lot of group affection using dreary mode, but not all website has a dreary version. Almost 40% of web leaf loads are from users in dreary mode, and yet only 10% of leaf loads assistance it. If you affection dreary mode, you’ve likely hit a location that felt particularly bright. Adaptive Dark Mode is designed to near that gap, providing a accordant dreary cognition throughout the web.

You can try it today in Safari 27.3 beta. To enable, archetypal create certain your scheme appearance is set to dark. Then browse to a website alongside a brilliant background. Safari volition recommendation a preview of Adaptive Dark Mode. Tap ‘Try’.
For websites that indication assistance of dreary manner alongside <meta name="color-scheme" content="light dark"> in HTML or color-scheme: ray dreary in CSS, Adaptive Dark Mode does not alter a thing. For the remainder of the web, it quickly analyzes the page, looking at colors and estimating whether it’s predominantly ray or dark. If the leaf mostly has a dreary backdrop alongside ray text, nothing is changed. When a leaf has a ray appearance, Adaptive Dark Mode adapts the leaf to be dark.
How does Adaptive Dark Mode work?
At the center of Adaptive Dark Mode is the transformation of color. Sometimes colors are merely decorative, during another times they have semantic meaning. Adaptive Dark Mode determines whenever to invert colors so elements remain apparent or whenever to depart colors unchanged.
While creating Adaptive Dark Mode, we developed a color matrix to invert the luminosity of colors during preserving hue. It’s used to create ray backgrounds dark, and dreary content light. When transforming content color, Adaptive Dark Mode aims for adequate difference as defined by the WCAG 4.5:1 difference ratio. Light CSS gradients are additionally transformed to dark.
Adaptive Dark Mode makes careful judgments so transformed satisfied looks fine and stays usable: buttons have difference against backgrounds, content is apparent complete images, and hover menus appearance clear.
It takes the identical attention alongside images. Most are remaining unchanged, preserving their integrity. But many icons and logos can endure difference whenever the backdrop color rearward them is inverted. So Adaptive Dark Mode inspects SVG images and transforms colors whenever needed. For bitmap images, it analyzes the pixel histograms and inverts uncomplicated black-and-white logos.
Effects akin masks and mix-blend-mode can create undesirable results on an component whose colors have been transformed, so in several cases Adaptive Dark Mode turns specified effects off. Also, <canvas> satisfied is remaining unchanged, since canvases merge a broad range of satisfied that’s difficult to predict.
It’s exactly since Adaptive Dark Mode is happening profound inside the WebKit browser motor that we are capable to discover imaginative ways to resolve the most complex challenges, use the transformations alongside awesome speed and power efficiency, all during rigorously protecting person privacy.
Making your location activity equal better
In general, a web leaf volition activity fine alongside Adaptive Dark Mode if it follows fine contemporary web betterment practices.
If your location motionless uses older techniques, small updates can help. For logos and icons, toggle bitmap images for SVG. Use firm or gradient colors in CSS alternatively of tiled backdrop images. Replace depiction sprites alongside contemporary CSS for rounded corners, shadows, and clasp states. Create satisfied images alongside transparent backgrounds alternatively of baking the leaf backdrop color into the image. Add padding to containers to forestall crowding.
Perhaps you desire a particular dreary manner cognition for a certain part of the page. Apply color-scheme: ray dark to the applicable component and add your own dreary styles.
Building your own dreary mode
For complete authority complete how your location looks in dreary mode, add complete support. It’s a terrific period to do so. It’s never been easier.

All the web innovation needed to completely assistance dreary manner is extensively accessible today, including:
- <meta name="color-scheme" content="light dark">
- :root { color-scheme: ray dreary }
- @media (prefers-color-scheme: dark) { }
- <picture><source media="(prefers-color-scheme: dark)">
- light-dark()
Newer CSS functions akin color-mix() and contrast-color(), affirmative famous techniques for organizing scheme systems alongside CSS variables provision additional options and flexibility.
Be certain to province dreary manner assistance using the color-scheme meta tag in your HTML caput and/or by environment the color-scheme asset on :root or build in your CSS. Don’t delay to inject this data afterward via JavaScript. This finest custom helps justify your location is rendered correctly as accelerated as possible.
Using the “light only” color scheme
If you would akin your web app or website to not be transformed by Adaptive Dark Mode, you can communicate this using color-scheme. The HTML <meta name="color-scheme" content="light only"> tag lets browsers cognize that 1) this leaf supports ray manner and 2) should lone be displayed in ray mode. The color-scheme: ray lone regulation does the identical thing, but alongside the elasticity of CSS, allowing you to fair mark particular elements on the leaf — or of course, you can mark the entire leaf alongside :root { }. (Note: the ‘only’ keyword is not supported in Safari 27.3 beta 1. Check rear as Adaptive Dark Mode evolves through the beta process.)
Protecting person privacy
Apple firmly believes person privacy is a essential individual right. If websites could detect whenever a person has enabled Adaptive Dark Mode, that would addition the amount of fingerprintable data and weaken privacy protections against trackers.
As a result, Safari prevents websites from detecting whenever Adaptive Dark Mode has been applied. JavaScript that queries CSS colors volition get the first authored colors, not the transformed ones. Any images drawn into canvas render in their first form.
Feedback
If you oversee a website or web app, and would akin to conversation how Adaptive Dark Mode is adapting your project, awareness liberated to attain out at [email protected].
If you try out Adaptive Dark Mode as a user, and discover a location that does not activity well, we’d affection for you to document a study alongside Feedback Assistant. (Learn additional concerning filing Feedback).