mediawiki-skins-MinervaNeue/resources/skins.minerva.base.styles/CSSCustomProperties.less

108 lines
3.5 KiB
Plaintext
Raw Normal View History

/**
* Minerva CSS Custom properties
* ----------------------------
* Please be aware that these properties are accessible via *any* client-side code.
* These variables should mirror Codex design token names and values:
* https://doc.wikimedia.org/codex/latest/design-tokens
* Only include properties that are required for client-side modification.
*
* @private - Currently, these variables are only intended for use by Minerva,
* however, they are designed to mimic the naming convention in Codex tokens
* in order to facilitate an eventual migration to a centralized source.
* @experimental
* @since February 2024 (MediaWiki 1.43)
*/
@import 'mediawiki.skin.variables.less';
@import 'mediawiki.skin.codex-design-tokens/theme-wikimedia-ui-mixin-dark.less';
@import 'mediawiki.skin.codex-design-tokens/theme-wikimedia-ui-reset.less';
/**
* Placeholder Night mode color palette.
* NOTE: These values are temporarily hard coded.
*/
.mixin-night-mode-palette() {
.cdx-mode-dark();
// <T361717>FIXME: These can be removed when T361717 is resolved.
--minerva-diff-deletedline: #886525;
--minerva-diff-addedline: #36c;
// </T361717>
}
/**
* == Forced night mode ==
* Applies the night mode color palette per the users explicit preference,
* regardless of system settings.
*/
html.skin-theme-clientpref-night {
color-scheme: dark;
.mixin-night-mode-palette();
// T363911 Temporarily override Codex variable for Vector night mode release
// Remove after task has been resolved and new color is available in Codex.
--color-link-red: #b97876;
}
/**
* == Auto night mode ==
* Applies the night mode color palette only in response to system settings.
*/
@media ( prefers-color-scheme: dark ) {
html.skin-theme-clientpref-os {
color-scheme: light dark;
.mixin-night-mode-palette();
// T363911 Temporarily override Codex variable for Vector night mode release
// Remove after task has been resolved and new color is available in Codex.
--color-link-red: #b97876;
}
}
/**
* == Night-mode helpers ==
* The following classes are provided to help third-parties deal with night mode when using the
* CSS color variables is not feasible.
*
* .skin-invert - This class implements an inverted night-mode effect on applied elements using
* a CSS filter instead of CSS custom properties. For this effect to work, the light mode palette
* has to be applied to avoid inverting night-mode colors.
*
* .notheme - This class prevents night mode from being applied to a specific element. It needs the
* the light mode color palette, and includes an opinionated color: var( --color-base ); rule
* since the main assumption underlying the light theme is black text.
*/
/**
* Light mode
*
* Applies the light mode color palette by default
* or with the .skin-invert, or .notheme classes
*/
:root,
.skin-invert,
.notheme {
.cdx-mode-reset();
// <T361717>FIXME: These can be removed when T361717 is resolved.
--minerva-diff-addedline: @color-success;
--minerva-diff-deletedline: @color-destructive;
// </T361717>
}
.skin-invert,
.notheme {
color-scheme: light;
color: var( --color-base );
}
// T365102 invert class specifically for image related elements
html.skin-theme-clientpref-night .skin-invert-image img,
html.skin-theme-clientpref-night .skin-invert {
filter: invert( 1 ) hue-rotate( 180deg );
}
@media ( prefers-color-scheme: dark ) {
// T365102 invert class specifically for image related elements
html.skin-theme-clientpref-os .skin-invert-image img,
html.skin-theme-clientpref-os .skin-invert {
filter: invert( 1 ) hue-rotate( 180deg );
}
}