Postponed on #3606655: Make dark mode a first class citizen of Drupal core and #3517033: Add a style utility API

Problem/Motivation

#3606655: Make dark mode a first class citizen of Drupal core moves the dark mode setting from Default Admin to a central feature, but it's still Drupal-centric.

In #44, @pdureau gives real-world examples of the benefit to using a more agnostic approach:

I agree $variables['html_attributes']['data-color-scheme'] is too specific. This attributes will depend of the design (system) implementation in the theme.

Examples:

Sometimes this attribute or class can be added only on specific elements, like HTML or BODY, HTML, sometimes anywhere.

That's why I believe ticket must be done and merged hand-to-hand with #3517033: Add a style utility API. Here, we manage:

  • User specific value, extending User/Account/Session API and managing the related cache
  • Specific settings for admin_theme

In #3517033: Add a style utility API, we miss the User specific part, but we manage:

  • declaration of modes in theme (with plugin definition): the values, the meta, the renderable alterations...
  • in a more generic way (not only dark/light)

Choice of color mode is important for accessibility reasons, and making it easier for contrib / custom themes to use this setting helps accessibility.

Steps to reproduce

Proposed resolution

Coordinate with #3517033: Add a style utility API and adapt the new central dark mode setting to an API that suits various consumers better.

Remaining tasks

TBD

User interface changes

Introduced terminology

API changes

TBD

Data model changes

TBD

Release notes snippet

Comments

kentr created an issue. See original summary.

kentr’s picture

Title: [PP-1] Make dark mode a first class citizen of Drupal core, Part 2 » [PP-2] Make dark mode a first class citizen of Drupal core, Part 2
Issue summary: View changes
Related issues: +#3517033: Add a style utility API