首页›WebKit›文章

Introducing Adaptive Dark Mode

2026年11月3日

AI 摘要 AI 生成,可能有误

苹果在 Safari 27.3 测试版中推出了自适应深色模式(Adaptive Dark Mode),该功能可为已启用深色模式的用户将浅色主题的网站转换为深色版本,从而解决了近 40% 的页面加载来自深色模式用户、但仅有 10% 的网站支持深色模式这一差距问题。该功能在 WebKit 引擎内运作,通过反转颜色亮度同时保留色相来实现,确保足够的对比度,有选择地转换 SVG 图像和简单徽标,并尊重通过 color-scheme 属性声明支持深色模式的页面。开发者可以使用 color-scheme: light only 选择退出该功能,同时 Safari 通过阻止网站检测自适应深色模式是否已被应用来保护用户隐私。

We’re excited to announce Adaptive Dark Mode in Safari 27.3 beta. When enabled by a user, Safari adapts light websites and presents them as dark.

In the spring of 2019, Safari 12.1 became the first browser to support dark mode on the web. A lot of people love using dark mode, but not every website has a dark version. Almost 40% of web page loads are from users in dark mode, and yet only 10% of page loads support it. If you love dark mode, you’ve probably hit a site that felt particularly bright. Adaptive Dark Mode is designed to close that gap, providing a consistent dark experience across the web.

You can try it today in Safari 27.3 beta. To enable, first make sure your system appearance is set to dark. Then browse to a website with a bright background. Safari will offer a preview of Adaptive Dark Mode. Tap ‘Try’.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 WebKit

Global Privacy Control (GPC) WebKit API

AI 摘要Starting with iOS, iPadOS, visionOS, and macOS 27, WebKit offers a new API for Global Privacy Control (GPC), an emerging web standard that lets users opt out of data sharing and cross-context targeted advertising, as recognized under the CCPA. Developers using WKWebView or SwiftUI's WebPage can enable it via the new globalPrivacyControlEnabled property on WKWebpagePreferences or the isGlobalPrivacyControlEnabled property on WebPage.NavigationPreferences, which activates navigator.globalPrivacyControl and the Sec-GPC: 1 header for the main frame, subframes, and subresources. Example code in Swift and Objective-C shows how to set these properties in the navigation-policy delegate based on a user preference.

Release Notes for Safari Technology Preview 257

AI 摘要Safari Technology Preview Release 257 is now available for macOS Golden Gate and macOS Tahoe, bringing a wide range of WebKit fixes for developers to test. The release includes numerous CSS layout and rendering corrections (covering flexbox, grid, tables, text-box-trim, and line clamping), along with fixes for animations, canvas drawing, form controls including new support for rendering `` as a dropdown and preview support for an enhanced `` element. Additional improvements address JavaScript error handling, media playback issues such as ogg audio and video seeking, and editing behavior like text re-wrapping.

Introducing spatial CSS: A developer preview

AI 摘要Safari on visionOS 27.3 introduces a limited developer preview of the proposed spatial CSS API, which brings spatial and 3D web capabilities to web authors through declarative CSS rather than JavaScript. The preview includes features such as spatial:portal transforms, position-anchor for snapping models together, @environment-map for managing lighting, portal-action:orbit for rotating scenes, and requestVolumetricScene() to present content outside the browser window. WebKit is seeking developer feedback on these features while emphasizing that spatial content should work across all devices, not just headsets.

Safari on Apple HomeView

AI 摘要Safari is now available on Apple HomeView, a new square, 7-inch smart display that users interact with by voice or touch, and since it runs on WebKit, most websites should already work without changes. Developers can enhance the experience by adding schema.org Recipe markup in JSON-LD to enable a step-by-step cooking view and including WebVTT captions in track elements for video. They should also avoid fragile assumptions like user agent sniffing or fixed viewport expectations, instead using semantic HTML, feature detection, and flexible, accessible layouts to handle HomeView's short, square screen.

Release Notes for Safari Technology Preview 256

AI 摘要Safari Technology Preview Release 256 is now available for macOS Golden Gate and macOS Tahoe, containing WebKit changes between revisions 323398@main and 324653@main. The release introduces new CSS features such as font-palette-mix(), text-combine-upright on ::marker, and continue: collapse with line-clamp, along with new canvas text drawing style options and object-fit support for SVG documents. It also resolves numerous accessibility, animation, CSS, forms, HTML, images, and JavaScript bugs, including performance improvements for scroll-driven animations and removal of deprecated body margin attributes.