/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/material/core/theming/tests/test-css-variables-theme.scss
39 строк
1 KB
Kristiyan Kostadinov
refactor(material/core): move M2-specific theming APIs into a separate directory (#28901)
18 апр 2024, 18:19
Не верифицирован
18 апр 2024, 18:19
4648f6b
Код
Авторство
О чём код?
@use 'sass:map'; @use 'sass:meta'; @use '../all-theme'; @use '../../m2/typography' as m2-typography; @use '../../m2/palette' as m2-palette; @use '../../m2/theming' as m2-theming; // Recursively replaces all of the values inside a Sass map with a different value. @function _replace-all-values($palette, $replacement) { $output: (); @each $key, $value in $palette { @if $key != _mat-theming-internals-do-not-access { @if (meta.type-of($value) == 'map') { $output: map.merge(($key: _replace-all-values($value, $replacement)), $output); } @else { $output: map.merge(($key: $replacement), $output); } } } @return $output; } // Theme used to test that our themes would compile if the colors were specified as CSS variables. ._demo-css-variables-theme { $palette: m2-theming.define-palette(m2-palette.$blue-grey-palette); $theme: m2-theming.define-dark-theme(( color: ( primary: $palette, accent: $palette, warn: $palette ), typography: m2-typography.define-typography-config(), )); $css-var-theme: _replace-all-values($theme, var(--test-var)); @include all-theme.all-component-themes($css-var-theme); }