Page MenuHomePhabricator

Allow users to switch Dark Mode on/off
Closed, ResolvedPublic

Description

Feature requested:

As a user, I want to be able to turn Dark Mode on/off with a simple toggle.

Functionality/software changes

Based on the outcome of T221809: Design UI for turning dark mode on and off , build a feature to allows users to one-click toggle Dark Mode. This link should be available to users that are logged in or are not logged in. The current state of the toggle should be maintained in localStorage for the user's client.

User interface changes

Screenshots/mockups:

To come.

Interface text/changes:

To come.

Does this need QA?

Yes.

Event Timeline

Since MediaWiki can be installed on a domain where other applications or JavaScript scripts may be installed it would be good to put the LocalStorage key in a namespace by prefixing the key with mw or mediawiki or something, followed by a dot (the . character).

Such as mw.dark-mode = "true", or mw.prefers-color-scheme = "dark".

Get config:

const scheme = localStorage.getItem('mw.dark-mode') ?? 'light';

Set config:

localStorage.setItem('mw.dark-mode', 'dark');

A constant could also be used to refer to the key.

const KEY_PREFERS_COLOR_SCHEME = 'mw.prefers-color-scheme';

Since MediaWiki can be installed on a domain where other applications or JavaScript scripts may be installed it would be good to put the LocalStorage key in a namespace by prefixing the key with mw or mediawiki or something, followed by a dot (the . character)...

This was done in rEDKM35855e4111452c163724350c44362ab6a731c8fe (with the persistence part in rEDKM0224fa679de8bef0fddadb46e1b4b25550f6b0f5). Most of these tasks just have not been closed since Community Tech abandoned the extension.

Most of these tasks just have not been closed since Community Tech abandoned the extension.

Wait! What? Is this extension abandoned? Why? I need dark mode!

@Frap: Please move general discussion to https://www.mediawiki.org/wiki/Extension_talk:DarkMode . This ticket is specifically about implementing "Allow users to switch Dark Mode on/off", not for general discussion. Thanks a lot!

MusikAnimal claimed this task.
MusikAnimal subscribed.

The extension is not abandoned – in fact it is in active development and this task has long been resolved. However the extension will not be deployed to WMF wikis. More info at https://meta.wikimedia.org/wiki/Community_Tech/Status_report_for_2019_wishlist#Night_Mode