| 1 |
# 1. Drop support for Less color functions with Codex design tokens |
| 2 |
|
| 3 |
Date: 2024-02-16 |
| 4 |
Last Edited: 2024-06-10 |
| 5 |
|
| 6 |
## Update June 2024 |
| 7 |
As of T363743, we will no longer be using CSS variables directly, rather we are |
| 8 |
back to using codex design tokens (LESS variables) so that the design system |
| 9 |
team can maintain a unified source of truth and also supply fallback values |
| 10 |
|
| 11 |
Given that the LESS variables are still of type string, color function support |
| 12 |
is still dropped |
| 13 |
|
| 14 |
## Status |
| 15 |
|
| 16 |
Updated |
| 17 |
|
| 18 |
## Context |
| 19 |
|
| 20 |
In order to reduce the strain on other teams/developers to update their extensions to use |
| 21 |
CSS variables rather than LESS, we decided to use [Wikimedia skin variables](https://www.mediawiki.org/wiki/Codex#Using_Codex_design_tokens_in_MediaWiki_and_extensions) to re-map LESS variables to their |
| 22 |
CSS variable equivalent. |
| 23 |
|
| 24 |
e.i. `@color-progressive: var( --color-progressive )`; |
| 25 |
|
| 26 |
This is consistent with the Codex design token experimental build which we will |
| 27 |
make use of in [T358059](https://phabricator.wikimedia.org/T358059). |
| 28 |
|
| 29 |
This approach has implications on LESS function that manipulate colors, such as |
| 30 |
`average`, `fade` and `tint`. These functions expect a parameter of type color. |
| 31 |
This approach changes the variable type from color to string, causing these |
| 32 |
functions to fail. |
| 33 |
|
| 34 |
## Decision |
| 35 |
|
| 36 |
Given there are few consumers of these LESS functions, we've decided to remove support |
| 37 |
for LESS functions that operate on colors. The benefit of this decision is that |
| 38 |
it will reduce non-standard colors across the UI. |
| 39 |
|
| 40 |
## Consequences |
| 41 |
|
| 42 |
Extensions that need to work with MinervaNeue for the time being can no longer |
| 43 |
use Less color functions with Codex design tokens. They can continue to use |
| 44 |
these function if they instead make use of hardcoded hex values (with an |
| 45 |
accompanying comment explaining this reason). |
| 46 |
|
| 47 |
We filed [a ticket](https://phabricator.wikimedia.org/T357740) for addressing this on the |
| 48 |
long term. This may require upgrading our version of LESS to a more modern |
| 49 |
version or a decision to drop support altogether. |