mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
77b5eed024
Extract all colors from the stylesheets, reduce their number by merging the similar ones and organize them into themes represented by CSS variables. PR Close #60374
31 lines
699 B
SCSS
31 lines
699 B
SCSS
/* Keep class names in sync with ThemeService */
|
|
$dark-theme-class: 'dark-theme';
|
|
$light-theme-class: 'light-theme';
|
|
|
|
/* $browser expects 'chrome', 'firefox' or 'safari' */
|
|
@mixin _theme($theme, $browser: '') {
|
|
@if $browser == '' {
|
|
:host-context(:root.#{$theme}) {
|
|
@content;
|
|
}
|
|
} @else {
|
|
/* Keep browser class name in sync with BrowserService. */
|
|
$browser-class: $browser + '-ui';
|
|
:host-context(:root.#{$theme}.#{$browser-class}) {
|
|
@content;
|
|
}
|
|
}
|
|
}
|
|
|
|
@mixin dark-theme($browser: '') {
|
|
@include _theme($dark-theme-class, $browser) {
|
|
@content;
|
|
}
|
|
}
|
|
|
|
@mixin light-theme($browser: '') {
|
|
@include _theme($light-theme-class, $browser) {
|
|
@content;
|
|
}
|
|
}
|