forked from angular/components
/
_snack-bar-theme.scss
78 lines (69 loc) · 2.49 KB
/
_snack-bar-theme.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@use '../core/theming/theming';
@use '../core/mdc-helpers/mdc-helpers';
@use '../core/typography/typography';
@use '../core/typography/typography-utils';
@use '@material/theme/theme-color' as mdc-theme-color;
@use '@material/snackbar/snackbar-theme' as mdc-snackbar-theme;
@use 'sass:color';
@use 'sass:map';
@use 'sass:meta';
@mixin color($config-or-theme) {
$config: theming.get-color-config($config-or-theme);
$is-dark-theme: map.get($config, is-dark);
$accent: map.get($config, accent);
@include mdc-helpers.using-mdc-theme($config) {
.mat-mdc-snack-bar-container {
$button-color:
if($is-dark-theme, currentColor, theming.get-color-from-palette($accent, text));
--mat-mdc-snack-bar-button-color: #{$button-color};
$on-surface: mdc-theme-color.prop-value(on-surface);
$surface: mdc-theme-color.prop-value(surface);
@include mdc-snackbar-theme.theme((
container-color: if(
meta.type-of($on-surface) == color and meta.type-of($surface) == color,
color.mix($on-surface, $surface, 80%),
$on-surface
),
supporting-text-color: if(
meta.type-of($surface) == color,
rgba($surface, mdc-theme-color.text-emphasis(high)),
$surface
)
));
}
}
}
@mixin typography($config-or-theme) {
$config: typography.private-typography-to-2018-config(
theming.get-typography-config($config-or-theme));
@include mdc-helpers.using-mdc-typography($config) {
@if ($config) {
.mat-mdc-snack-bar-container {
@include mdc-snackbar-theme.theme((
supporting-text-font: typography-utils.font-family($config, body-2),
supporting-text-line-height: typography-utils.line-height($config, body-2),
supporting-text-size: typography-utils.font-size($config, body-2),
supporting-text-weight: typography-utils.font-weight($config, body-2),
));
}
}
}
}
@mixin density($config-or-theme) {}
@mixin theme($theme-or-color-config) {
$theme: theming.private-legacy-get-theme($theme-or-color-config);
@include theming.private-check-duplicate-theme-styles($theme, 'mat-snack-bar') {
$color: theming.get-color-config($theme);
$density: theming.get-density-config($theme);
$typography: theming.get-typography-config($theme);
@if $color != null {
@include color($color);
}
@if $density != null {
@include density($density);
}
@if $typography != null {
@include typography($typography);
}
}
}