Page MenuHomePhabricator

Editors should be able to request light or night theme always applies to a certain element
Closed, ResolvedPublic

Description

Background

While working on getting night mode enabled for Wikistories we discussed a situation where Wikistories highlights text in yellow. In this situation the night mode should mimic light mode. This is also likely to be necessary for the reference preview in the mobile site, which always uses the night theme.

Ideally, it should be as simple as adding the rule color-scheme: light; to the content or adding a class.

Perhaps for background and color in particular we may want to define https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark
We may need direct access to night mode / light mode design tokens. e.g. var( --color-base-night ) and var( --color-base-light )

Current and proposed:

Screenshot 2024-02-29 at 5.10.10 PM.png (378×1 px, 129 KB)
Screenshot 2024-02-29 at 5.09.56 PM.png (802×1 px, 193 KB)

User story

As an editor I want to be able to markup my content as light-theme only, in situations where no night mode is provided and I don't plan to provide one.

Requirements

  • As an editor I can mark my content up in such a way that it gets the light mode theme
  • As an editor I can mark my content up in such a way that it gets the night mode theme

Acceptance criteria

Event Timeline

Jdlrobson updated the task description. (Show Details)

We decided to punt this to sprint 6 as next sprint we need more information to make a decision here - we don't want to apply a fix just for this one case.
(Provisionally we were looking at an estimate of 3)

Questions:

  • What specific elements or types of content require the implementation of a CSS class or variable for theme control?

Context to add:

  • We need to discuss the how, and provide a technical specifications for implementing a CSS class and/or variable dedicated to theme control.
  • We need to provide at the end of this guidelines or examples available for editors on how to effectively use the CSS class and/or variable for theme control.
Jdlrobson changed the task status from Open to Stalled.Mar 18 2024, 7:00 PM

Another use case:

  • certain templates may want to mark themselves in such a way that the CSS variables used are for the standard theme. Right now they can't do that - and instead must add CSS to cater for both modes.
  • T360222

It looks like notheme already does this So maybe this is done? Is there any behaviour we want to work slightly differently?

Jdlrobson claimed this task.
Jdlrobson added a subscriber: thiemowmde.

@thiemowmde just did this for Kartographer in T359082 and that seemed to work pretty well, so I am happy to resolve this now.
This is documented here: https://www.mediawiki.org/wiki/Recommendations_for_night_mode_compatibility_on_Wikimedia_wikis#Overriding_night_mode_styles_/_disabling_the_night_mode_theme