mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
28 lines
657 B
SCSS
28 lines
657 B
SCSS
/* Keep class names in sync with ThemeService */
|
|
$dark-theme-class: 'dark-theme';
|
|
$light-theme-class: 'light-theme';
|
|
|
|
/* $top-level-style is required when the mixin is used in a global/top-level stylesheet. */
|
|
@mixin _theme($theme, $top-level-style: false) {
|
|
@if $top-level-style == false {
|
|
:host-context(:root.#{$theme}) {
|
|
@content;
|
|
}
|
|
} @else {
|
|
.#{$theme} {
|
|
@content;
|
|
}
|
|
}
|
|
}
|
|
|
|
@mixin dark-theme($top-level-style: false) {
|
|
@include _theme($dark-theme-class, $top-level-style) {
|
|
@content;
|
|
}
|
|
}
|
|
|
|
@mixin light-theme($top-level-style: false) {
|
|
@include _theme($light-theme-class, $top-level-style) {
|
|
@content;
|
|
}
|
|
}
|