How to Inspect and Control CSS color-scheme for Native Form Controls in Safari Web Inspector

Dark Mode Adaptation and the CSS color-scheme Property

Modern responsive websites frequently implement dark themes using CSS custom properties and the prefers-color-scheme media query. However, web developers often encounter an unsettling visual inconsistency: while custom text and background colours flip to dark tones, native operating system UI elements—such as form inputs, dropdown select menus, checkboxes, radio buttons, calendar date pickers, and browser scrollbars—continue rendering with stark, blinding light backgrounds.

This dissonance occurs because the browser does not assume that a webpage is designed to accommodate dark mode for native controls unless the page explicitly signals its support. The CSS color-scheme property provides this explicit declaration to WebKit in Apple Safari. By declaring color-scheme: light dark; or scoping color-scheme: dark; to specific DOM subtrees, Safari automatically swaps all native controls, scrollbar tracks, and the default canvas background to match the active system theme without requiring cumbersome form styling overrides.

In Safari Web Inspector on macOS, developers can inspect computed color-scheme inheritance, live-edit scheme values, and simulate system appearance changes in real time.

Enabling Safari Web Inspector on macOS

To inspect and debug stylesheets, ensure Safari’s developer tools are active. If the Develop menu is absent from the macOS menu bar, enable it through Safari settings:

  1. Open Safari and navigate to Safari > Settings (or press Cmd + ,).
  2. Select the Advanced tab.
  3. Check the option labelled “Show features for web developers” (in earlier macOS versions, “Show Develop menu in menu bar”).

With developer features enabled, right-click any form control on the webpage and choose Inspect Element, or press Option + Cmd + I to launch Web Inspector.

Inspecting Computed color-scheme on Form Controls

In the Web Inspector Elements panel, select a native form control such as an <input type="text">, <select>, or <input type="date">.

In the right-hand panel, switch to the Computed tab and search for color-scheme:

  • If color-scheme reports normal (the browser default), Safari forces native form inputs to render using classic light mode assets, even when the user’s macOS system appearance is set to Dark Mode.
  • If color-scheme resolves to light dark, Safari dynamically synchronises native inputs with the operating system appearance.
  • If color-scheme resolves to dark, the element and its descendants are rendered exclusively using dark-themed native chrome, including dark date picker popovers and dark scrollbars.

Declaring color-scheme in Modern CSS

To support full-system dark mode across the entire document, declare color-scheme on the root pseudo-class or HTML element:

/* Declare universal light and dark mode capability */
:root {
    color-scheme: light dark;
}

/* Optional: Enforce dark theme with dark canvas fallback */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        background-color: #121212;
        color: #f3f4f6;
    }
}

Alternatively, the declaration can be placed in HTML metadata, informing WebKit before external stylesheets even download:

<meta name="color-scheme" content="light dark">

This HTML meta tag prevents the momentary “flash of white” that can occur during page navigation when dark mode is active.

Scoping Dark Controls to Specific Containers

The color-scheme property is not restricted to the root document; it can be scoped to individual sections. For instance, in an enterprise application featuring a dark sidebar navigation panel alongside a light content workspace, scope color-scheme: dark strictly to the sidebar:

/* Scope dark form controls to specific UI panels */
.dark-sidebar {
    color-scheme: dark;
    background-color: #1f2937;
    color: #ffffff;
}

.dark-sidebar input,
.dark-sidebar select {
    /* Native controls inside sidebar render in dark mode automatically */
}

Any native select dropdown, input cursor, or scrollbar within .dark-sidebar automatically adopts dark mode rendering, while the rest of the application remains light.

Live-Testing and Emulating Appearance in Web Inspector

Safari Web Inspector provides integrated emulation tools to test color-scheme rendering without toggling macOS system settings:

  1. Click the Graphics / Device Simulation icon in the Web Inspector toolbar or open the Console drawer.
  2. Locate the Appearance Emulation toggle (represented by a split half-moon or sun/moon icon).
  3. Toggle between Light and Dark appearance.
  4. Observe how form controls dynamically switch background shading, border tones, and calendar widgets when color-scheme: light dark is present.

To test overrides on a specific element, select the target element in the DOM tree, add color-scheme: dark; directly in the element.style {} block, and observe how the native form control transforms instantly.

Leveraging color-scheme eliminates hundreds of lines of brittle CSS hacks, ensuring native Safari controls, scrollbars, and form widgets integrate seamlessly into modern dark-mode layouts.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.