Jump to content

Allow creation of CSS variables for colors in TemplateStyles (Community Wishlist/W502)

Under review
From Meta, a Wikimedia project coordination wiki

View all wishes.

Description

Currently, when a color needs to be adapted for dark mode, the CSS selectors targeting it must be copied three times: once for light mode, once for dark mode, and once for automatic mode. Additionally, if a child template wants to override this color, the selectors must be copied three more times, plus targeting for a specific class each time.

Being able to define CSS variables would mean only needing to modify the color value based on the selected mode and the child-specific selectors, without having to repeat the other selectors every time. This would simplify code readability and maintenance, and make child templates less vulnerable to changes in parent templates.

This wish specifically concerns defining CSS variables whose values are valid colors. In particular, it does not involve allowing the url() function, whose security risks are mentioned in the related Phabricator task.

Assigned focus area

Unassigned

Type of wish
Feature request
Tags
Affected users

template editors

Phabricator tasks
Other details
  • Created: 09:43, 30 January 2026
  • Last updated: 15:42, 1 February 2026
  • Author: Escargot bleu (talk)
Voting

This wish currently has 7 supporters. Voting for this wish is open until it is completed.

Supporters of this wish
Support Escargot bleu (talk) 09:43, 30 January 2026
Support Pppery (talk) 02:27, 3 February 2026
Support Ponor (talk) 17:57, 7 February 2026
Support ZandDev (talk) 01:53, 27 February 2026
Support Robertsky (talk) 11:11, 10 March 2026
Support Sohom Datta (talk) 16:39, 20 March 2026
Support Asked42 (talk) 16:13, 30 March 2026