Skip to content

Dark Style Preference

Daniel Foré edited this page Sep 13, 2019 · 11 revisions

FreeDesktop.org Dark Style Preference (Draft)

An FD.o Proposal for detecting a user's desire for apps to use a dark color scheme. Describes a method for desktop environments, toolkits, and apps to implement and react to a user preference for a dark style. Feedback and discussion on the implementation is welcome.

An implementation is currently in progress for elementary OS and the Pantheon desktop environment.

Inspired by the draft CSS web specification and Cassidy’s The Need for a FreeDesktop Dark Style Preference talk.

Authors

Version 1.1 (draft)

Sep 13, 2019

Desktop Agnostic

Store a user's preference for a dark color scheme

Name: prefers-color-scheme
Type: enum
Values: no-preference | dark

Desktop Environments

Optionally display a setting for a dark style.

Note that it is not explicitly a choice between "light" or "dark", as media or content-centric apps may still render dark when a dark preference is not explicitly set.

Consequently, desktops should present this to users as a "Prefer dark style" toggle (or similar) with appropriate copy detailing what it might affect.

For system-level "shell" UI, the system can choose what to do in response to this preference. If the default shell UI is dark, no change is needed. However, if the default shell UI is light, the shell should respond to this preference by changing to a dark UI. Other components of the system like wallpapers may respond to this preference if there is a dark variant provided.

Toolkit Behavior

Translate the desktop agnostic key into a property:

Name: prefers-color-scheme
Type: enum
Values: no-preference | dark

Provide a signal or hook:

Name: color-scheme-preference-changed
Type: enum
Values: no-preference | dark

Provide a method for developers to either manually set their own preference or react to changes in user preference:

Name: application-prefer-color-scheme
Type: enum
Values: no-preference | dark

Toolkits should not automatically render the UI in a dark style in response to this user preference; Apps must Opt In

App Behavior

Apps should bind to this preference (either manually or via toolkit helpers), appropriately updating their styling in response to changes. If an app provides an in-app toggle that includes a dark style, the app should also provide a "follow system preference" setting that is enabled by default.

No dark preference

The user has not expressed a specific preference for UI styling. As such, the app should use its normal styling, whether that is light or dark. For example, document-centric apps should remain light, and media-centric apps should remain dark.

Dark preference

The user has explicitly expressed that they prefer dark styled user interfaces. Consequently, the app should render itself in a dark style, whether via manual styling or by requesting the toolkit's dark variant. Care should be taken so that the app UI is still contrast-compliant, for example by using desaturated accent colors to increase contrast and legibility.

If the app is already dark or using otherwise custom styling where a dark style does not make sense, it can safely ignore this preference.


See also: The Need for a FreeDesktop Dark Style Preference