| 1 |
/** |
| 2 |
* Minerva CSS Custom properties |
| 3 |
* ---------------------------- |
| 4 |
* Please be aware that these properties are accessible via *any* client-side code. |
| 5 |
* These variables should mirror Codex design token names and values: |
| 6 |
* https://doc.wikimedia.org/codex/latest/design-tokens |
| 7 |
* Only include properties that are required for client-side modification. |
| 8 |
* |
| 9 |
* @private - Currently, these variables are only intended for use by Minerva, |
| 10 |
* however, they are designed to mimic the naming convention in Codex tokens |
| 11 |
* in order to facilitate an eventual migration to a centralized source. |
| 12 |
* @experimental |
| 13 |
* @since February 2024 (MediaWiki 1.43) |
| 14 |
*/ |
| 15 |
|
| 16 |
@import 'mediawiki.skin.variables.less'; |
| 17 |
@import 'mediawiki.skin.codex-design-tokens/theme-wikimedia-ui-mixin-dark.less'; |
| 18 |
@import 'mediawiki.skin.codex-design-tokens/theme-wikimedia-ui-reset.less'; |
| 19 |
|
| 20 |
/** |
| 21 |
* Placeholder Night mode color palette. |
| 22 |
* NOTE: These values are temporarily hard coded. |
| 23 |
*/ |
| 24 |
.mixin-night-mode-palette() { |
| 25 |
.cdx-mode-dark(); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* == Night-mode helpers == |
| 30 |
* The following classes are provided to help third-parties deal with night mode when using the |
| 31 |
* CSS color variables is not feasible. |
| 32 |
* |
| 33 |
* .skin-invert - This class implements an inverted night-mode effect on applied elements using |
| 34 |
* a CSS filter instead of CSS custom properties. For this effect to work, the light mode palette |
| 35 |
* has to be applied to avoid inverting night-mode colors. |
| 36 |
* |
| 37 |
* .notheme - This class prevents night mode from being applied to a specific element. It needs the |
| 38 |
* the light mode color palette, and includes an opinionated color: @color-base; rule |
| 39 |
* since the main assumption underlying the light theme is black text. |
| 40 |
*/ |
| 41 |
|
| 42 |
/** |
| 43 |
* Light mode |
| 44 |
* |
| 45 |
* Applies the light mode color palette by default |
| 46 |
* or with the .skin-invert, or .notheme classes |
| 47 |
*/ |
| 48 |
:root, |
| 49 |
.skin-invert, |
| 50 |
.notheme { |
| 51 |
.cdx-mode-reset(); |
| 52 |
} |
| 53 |
|
| 54 |
.skin-invert, |
| 55 |
.notheme { |
| 56 |
color-scheme: light; |
| 57 |
color: @color-base; |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* == Forced night mode == |
| 62 |
* Applies the night mode color palette per the users explicit preference, |
| 63 |
* regardless of system settings. |
| 64 |
*/ |
| 65 |
@media screen { |
| 66 |
html.skin-theme-clientpref-night { |
| 67 |
color-scheme: dark; |
| 68 |
.mixin-night-mode-palette(); |
| 69 |
|
| 70 |
.skin-invert, |
| 71 |
.skin-invert-image img, |
| 72 |
/* Special treatment of inverted OOUI icons, see T365764 */ |
| 73 |
.oo-ui-iconElement-icon:not( .oo-ui-image-progressive ):not( .oo-ui-image-destructive ):not( .oo-ui-checkboxInputWidget-checkIcon ):not( .oo-ui-image-invert ):not( .mw-no-invert ), |
| 74 |
.oo-ui-indicatorElement-indicator { |
| 75 |
filter: invert( 1 ) hue-rotate( 180deg ); |
| 76 |
} |
| 77 |
|
| 78 |
/* Do not apply invert to elements that are inside a notheme or a skin-invert class to avoid inversion in light theme or |
| 79 |
double inversion in an already inverted element */ |
| 80 |
.skin-invert, |
| 81 |
.notheme { |
| 82 |
.oo-ui-iconElement-icon:not( .oo-ui-image-progressive ):not( .oo-ui-image-destructive ):not( .oo-ui-checkboxInputWidget-checkIcon ):not( .oo-ui-image-invert ):not( .mw-no-invert ), |
| 83 |
.oo-ui-indicatorElement-indicator { |
| 84 |
filter: none !important; |
| 85 |
} |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* == Auto night mode == |
| 92 |
* Applies the night mode color palette only in response to system settings. |
| 93 |
*/ |
| 94 |
@media screen and ( prefers-color-scheme: dark ) { |
| 95 |
html.skin-theme-clientpref-os { |
| 96 |
color-scheme: light dark; |
| 97 |
.mixin-night-mode-palette(); |
| 98 |
|
| 99 |
.skin-invert, |
| 100 |
.skin-invert-image img, |
| 101 |
.oo-ui-iconElement-icon:not( .oo-ui-image-progressive ):not( .oo-ui-image-destructive ):not( .oo-ui-checkboxInputWidget-checkIcon ), |
| 102 |
.oo-ui-indicatorElement-indicator { |
| 103 |
filter: invert( 1 ) hue-rotate( 180deg ); |
| 104 |
} |
| 105 |
|
| 106 |
/* Do not apply invert to elements that are inside a notheme or a skin-invert class to avoid inversion in light theme or |
| 107 |
double inversion in an already inverted element */ |
| 108 |
.skin-invert, |
| 109 |
.notheme { |
| 110 |
.oo-ui-iconElement-icon:not( .oo-ui-image-progressive ):not( .oo-ui-image-destructive ):not( .oo-ui-checkboxInputWidget-checkIcon ), |
| 111 |
.oo-ui-indicatorElement-indicator { |
| 112 |
filter: none !important; |
| 113 |
} |
| 114 |
} |
| 115 |
} |
| 116 |
} |