Page MenuHomePhabricator

Implement the dark mode color palette and switch LESS variables in Minerva to use it, degrade support for browsers that do not support CSS custom properties
Closed, ResolvedPublic3 Estimated Story Points

Description

We will adopt CSS custom properties in the mobile skin. This has implications on our browser support matrix. Older browsers (very old versions of Opera Mini, IE11) that do not support CSS custom properties will stop receiving certain colors and instead using the default browser color palette.

For example note the lack of a background color on IE11:

Screenshot 2024-02-01 at 3.00.38 PM.png (677×948 px, 469 KB)

TODO

  • Add an ADR to Minerva defining why are we using CSS custom properties
  • Switch all LESS variables using color (background,color,borders) to CSS custom properties
  • Define the light mode color palette using the LESS variables e.g. `--color-base: @color-base;`
  • Define a night mode color palette which is enabled when the .skin-darkmode-1 is on the HTML tag
  • Define a night mode color palette which applies when the .skin-darkmode-2 class is enabled on the HTML tag and the operating system specifies it prefers a night theme.

Design spec

Additional contest: T354891#9456985

@color-base: #EAECF0 gray200
@color-subtle: #C8CCD1 gray300
@color-link: #6699FF blue300
@color-link-new: #6699FF blue300
@color-link-selected: #94B8FF
@color-placeholder: #A2A9B1 gray400
@color-emphasized: #FFFFFF
@color-progressive: #6699FF blue300
@color-destructive: #FF4242 red500
@color-progressive--hover: #94B8FF
@background-color-base: #202122 gray700
@background-color-secondary: #2E3136 gray675
@background-color-secondary--modern: #202122 gray700
@color-visited: #9781BD

Developer sign off

Check that no LESS variables remain in the Minerva skin for the following queries:

ag "@(color|background-color|border-color)" --ignore resources/

QA

QA is covered in T350170.

  • Verify in Pixel that no colors change in the default theme.

QA Results - Beta

ACStatusDetails
1T356074#9518227

QA Results - Prod

ACStatusDetails
1T356074#9567933

Event Timeline

bwang set the point value for this task to 3.Jan 29 2024, 6:19 PM

Change 993746 had a related patch set uploaded (by Jdlrobson; author: Jdrewniak):

[mediawiki/skins/MinervaNeue@master] Add ADR for CSS custom properties in Minerva

https://gerrit.wikimedia.org/r/993746

Change 969955 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Skins: Allow skins to use custom properties for colors

https://gerrit.wikimedia.org/r/969955

Change 994363 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] [POC] Skins: Drop support for browsers which do not support CSS variables

https://gerrit.wikimedia.org/r/994363

Test wiki created on Patch demo by Jdlrobson using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/88af0f3a47/w

Change 993746 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Add ADR for CSS custom properties in Minerva

https://gerrit.wikimedia.org/r/993746

Change 995065 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/skins/MinervaNeue@master] Convert all color related Less variables to CSS custom properties

https://gerrit.wikimedia.org/r/995065

Test wiki created on Patch demo by Jdlrobson using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/28eb2ce829/w

Test wiki created on Patch demo by Jdlrobson using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/ed76d6db14/w

Jdlrobson renamed this task from Implement the dark mode color palette and switch LESS variables in Minerva to use it to Implement the dark mode color palette and switch LESS variables in Minerva to use it, degrade support for browsers that do not support CSS custom properties.Feb 1 2024, 11:00 PM
Jdlrobson updated the task description. (Show Details)

Change 995125 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/skins/MinervaNeue@master] [POC] Convert all color related Less variables to CSS custom properties

https://gerrit.wikimedia.org/r/995125

Test wiki created on Patch demo by JDrewniak (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/6d791714f9/w

Change 995065 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Convert all color related Less variables to CSS custom properties

https://gerrit.wikimedia.org/r/995065

For the purposes of the Less variables to CSS custom props conversion, I only changed the variables that we already used in Minerva. Some of these might have the same color values but different names than in the task description:

:root {
    --background-color-base: #fff;
    --background-color-destructive: #d73333;
    --background-color-interactive: #eaecf0;
    --background-color-progressive-subtle: #eaf3ff;
    --border-color-base: #a2a9b1;
    --border-color-inverted: #fff;
    --border-color-progressive--focus: #36c;
    --border-color-subtle: #c8ccd1;
    --border-color-transparent: transparent;
    --box-shadow-color-progressive--focus: #36c;
    --color-base: #202122;
    --background-color-interactive-subtle: #f8f9fa;
    --color-inverted: #fff;
    --color-subtle: #54595d;
    --color-progressive: #36c;
    --color-visited: #6b4ba1;
    --color-progressive--active: #2a4b8d;
    --color-link: #0645ad;
    --color-link-red: #d73333;
    --color-link-red--visited: #a55858;
    --color-link-external: #36b;
    --color-link-external--visited: #636;
    --color-link-external--active: #b63;
    --box-shadow-color-drawer: rgba(0,0,0,0.35);
}

I hard coded the color values for dark mode because I don't think we ship variables with color names like gray200 (I might be wrong on that though).

html.skin-night-mode-1 {
    --color-base: #eaecf0;
    --color-subtle: #c8ccd1;
    --color-link: #69f;
    --color-link-red: #ff4242;
    --color-progressive: #69f;
    --background-color-destructive: #ff4242;
    --color-progressive--active: #94b8ff;
    --background-color-base: #202122;
    --color-visited: #9781bd;
    --background-color-interactive: #2e3136;
}
Jdlrobson added a subscriber: Jdrewniak.

QA is blocked on T355118 but I think we have what we need here (yay!)

Change 995342 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/skins/MinervaNeue@master] Follow-up to 59fd0cd (red-link typo)

https://gerrit.wikimedia.org/r/995342

Change 995342 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Follow-up to 59fd0cd (red-link typo)

https://gerrit.wikimedia.org/r/995342

Change 969955 abandoned by Jdlrobson:

[mediawiki/core@master] Skins: Allow skins to use custom properties for colors

Reason:

We are exploring other options where we map LESS variables directly to CSS variables. We do not need this for current stage of development or the prototype.

https://gerrit.wikimedia.org/r/969955

This can now be verified in Pixel. Not sure if I should assign this to you Edward or someone also as anyone can check Pixel on Monday :)

Edtadros subscribed.

Test Result - Beta

Status: ✅ PASS
Environment: beta/xyzwiki
OS: macOS Sonoma
Browser: Chrome
Device: MBA
Emulated Device:NA

Test Artifact(s):

QA Steps

QA is covered in T350170.

✅ AC1: Verify in Pixel that no colors change in the default theme.

screenshot 431.png (376×1 px, 63 KB)

Change 997940 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@master] Color subtle should be a CSS variable

https://gerrit.wikimedia.org/r/997940

Change 997940 merged by Jdlrobson:

[mediawiki/skins/MinervaNeue@master] Color subtle should be a CSS variable

https://gerrit.wikimedia.org/r/997940

Change 997962 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@master] Set text color on infoboxes

https://gerrit.wikimedia.org/r/997962

Change 997962 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Set text color on infoboxes

https://gerrit.wikimedia.org/r/997962

Jdlrobson claimed this task.

Change 994363 abandoned by Jdlrobson:

[mediawiki/core@master] [POC] Skins: Drop support for browsers which do not support CSS variables

Reason:

We are taking a slightly different approach to this that uses skin variables and requires no changes to core.

https://gerrit.wikimedia.org/r/994363

Change #995125 abandoned by Jdrewniak:

[mediawiki/skins/MinervaNeue@master] [POC] Convert all color related Less variables to CSS custom properties

Reason:

https://gerrit.wikimedia.org/r/995125

Test wiki on Patch demo by JDrewniak (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/6d791714f9/w/