|
2 | 2 | @import '../core/theming/theming';
|
3 | 3 |
|
4 | 4 |
|
5 |
| -@mixin _md-slide-toggle-checked($palette, $thumb-on-hue) { |
| 5 | +@mixin _md-slide-toggle-checked($palette, $thumb-checked-hue) { |
6 | 6 | // Do not apply the checked colors if the toggle is disabled, because the specificity would be to high for
|
7 | 7 | // the disabled styles.
|
8 | 8 | &.md-checked:not(.md-disabled) {
|
9 | 9 | .md-slide-toggle-thumb {
|
10 |
| - background-color: md-color($palette, $thumb-on-hue); |
| 10 | + background-color: md-color($palette, $thumb-checked-hue); |
11 | 11 | }
|
12 | 12 |
|
13 | 13 | .md-slide-toggle-bar {
|
14 |
| - background-color: md-color($palette, $thumb-on-hue, 0.5); |
| 14 | + background-color: md-color($palette, $thumb-checked-hue, 0.5); |
15 | 15 | }
|
16 | 16 | }
|
17 | 17 | }
|
18 | 18 |
|
19 | 19 | // TODO(jelbourn): remove this when the real ripple has been applied to slide-toggle.
|
20 |
| -@mixin _md-slide-toggle-ripple($palette, $foreground, $thumb-on-hue) { |
| 20 | +@mixin _md-slide-toggle-ripple($palette, $foreground, $thumb-checked-hue) { |
21 | 21 |
|
22 | 22 | &.md-slide-toggle-focused {
|
23 | 23 | &:not(.md-checked) .md-ink-ripple {
|
|
27 | 27 | }
|
28 | 28 |
|
29 | 29 | .md-ink-ripple {
|
30 |
| - background-color: md-color($palette, $thumb-on-hue, 0.26); |
| 30 | + background-color: md-color($palette, $thumb-checked-hue, 0.26); |
31 | 31 | }
|
32 | 32 | }
|
33 | 33 |
|
|
41 | 41 | $background: map-get($theme, background);
|
42 | 42 | $foreground: map-get($theme, foreground);
|
43 | 43 |
|
44 |
| - $thumb-on-hue: if($is-dark, 200, 500); |
45 |
| - $thumb-off-hue: if($is-dark, 400, 50); |
| 44 | + // Color hues based on the specs, which prescribe different hues for dark and light themes |
| 45 | + // https://material.google.com/components/selection-controls.html#selection-controls-switch |
| 46 | + $thumb-normal-hue: if($is-dark, 400, 50); |
| 47 | + $thumb-checked-hue: if($is-dark, 200, 500); |
46 | 48 | $thumb-disabled-hue: if($is-dark, 800, 400);
|
| 49 | + |
| 50 | + $bar-normal-color: md-color($foreground, disabled); |
47 | 51 | $bar-disabled-color: if($is-dark, rgba(white, 0.12), rgba(black, 0.1));
|
48 | 52 |
|
49 | 53 | md-slide-toggle {
|
50 |
| - @include _md-slide-toggle-checked($accent, $thumb-on-hue); |
51 |
| - @include _md-slide-toggle-ripple($accent, $foreground, $thumb-on-hue); |
| 54 | + @include _md-slide-toggle-checked($accent, $thumb-checked-hue); |
| 55 | + @include _md-slide-toggle-ripple($accent, $foreground, $thumb-checked-hue); |
52 | 56 |
|
53 | 57 |
|
54 | 58 | &.md-primary {
|
55 |
| - @include _md-slide-toggle-checked($primary, $thumb-on-hue); |
56 |
| - @include _md-slide-toggle-ripple($primary, $foreground, $thumb-on-hue); |
| 59 | + @include _md-slide-toggle-checked($primary, $thumb-checked-hue); |
| 60 | + @include _md-slide-toggle-ripple($primary, $foreground, $thumb-checked-hue); |
57 | 61 | }
|
58 | 62 |
|
59 | 63 | &.md-warn {
|
60 |
| - @include _md-slide-toggle-checked($warn, $thumb-on-hue); |
61 |
| - @include _md-slide-toggle-ripple($warn, $foreground, $thumb-on-hue); |
| 64 | + @include _md-slide-toggle-checked($warn, $thumb-checked-hue); |
| 65 | + @include _md-slide-toggle-ripple($warn, $foreground, $thumb-checked-hue); |
62 | 66 | }
|
63 | 67 |
|
64 | 68 | }
|
|
76 | 80 | }
|
77 | 81 |
|
78 | 82 | .md-slide-toggle-thumb {
|
79 |
| - background-color: md-color($md-grey, $thumb-off-hue); |
| 83 | + background-color: md-color($md-grey, $thumb-normal-hue); |
80 | 84 | }
|
81 | 85 |
|
82 | 86 | .md-slide-toggle-bar {
|
83 |
| - background-color: md-color($foreground, disabled); |
| 87 | + background-color: $bar-normal-color; |
84 | 88 | }
|
85 | 89 | }
|
0 commit comments