|
2 | 2 |
|
3 | 3 |
|
4 | 4 | @mixin md-checkbox-theme($theme) { |
5 | | - $is-dark-theme: map-get($theme, is-dark); |
6 | 5 | $primary: map-get($theme, primary); |
7 | 6 | $accent: map-get($theme, accent); |
8 | 7 | $warn: map-get($theme, warn); |
9 | | - $background: map-get($theme, background); |
10 | | - |
11 | | - |
12 | | - // The color of the checkbox border. |
13 | | - $checkbox-border-color: if($is-dark-theme, rgba(white, 0.7), rgba(black, 0.54)) !default; |
14 | | - |
15 | | - // The color of the checkbox's checkmark / mixedmark. |
16 | | - $checkbox-mark-color: md-color($background, background); |
17 | | - |
18 | | - // NOTE(traviskaufman): While the spec calls for translucent blacks/whites for disabled colors, |
19 | | - // this does not work well with elements layered on top of one another. To get around this we |
20 | | - // blend the colors together based on the base color and the theme background. |
21 | | - $white-30pct-opacity-on-dark: #686868; |
22 | | - $black-26pct-opacity-on-light: #b0b0b0; |
23 | | - $disabled-color: if($is-dark-theme, $white-30pct-opacity-on-dark, $black-26pct-opacity-on-light); |
24 | | - |
25 | | - .md-checkbox-frame { |
26 | | - border-color: $checkbox-border-color; |
27 | | - } |
28 | | - |
29 | | - .md-checkbox-checkmark { |
30 | | - fill: $checkbox-mark-color; |
31 | | - } |
32 | | - |
33 | | - .md-checkbox-checkmark-path { |
34 | | - // !important is needed here because a stroke must be set as an attribute on the SVG in order |
35 | | - // for line animation to work properly. |
36 | | - stroke: $checkbox-mark-color !important; |
37 | | - } |
38 | | - |
39 | | - .md-checkbox-mixedmark { |
40 | | - background-color: $checkbox-mark-color; |
41 | | - } |
42 | | - |
43 | | - .md-checkbox-indeterminate, .md-checkbox-checked { |
44 | | - &.md-primary .md-checkbox-background { |
45 | | - background-color: md-color($primary, 500); |
46 | | - } |
47 | | - |
48 | | - &.md-accent .md-checkbox-background { |
49 | | - background-color: md-color($accent, 500); |
50 | | - } |
51 | | - |
52 | | - &.md-warn .md-checkbox-background { |
53 | | - background-color: md-color($warn, 500); |
54 | | - } |
55 | | - } |
56 | | - |
57 | | - .md-checkbox-disabled { |
58 | | - &.md-checkbox-checked, &.md-checkbox-indeterminate { |
59 | | - .md-checkbox-background { |
60 | | - background-color: $disabled-color; |
61 | | - } |
62 | | - } |
63 | | - |
64 | | - &:not(.md-checkbox-checked) { |
65 | | - .md-checkbox-frame { |
66 | | - border-color: $disabled-color; |
67 | | - } |
68 | | - } |
69 | | - } |
70 | 8 |
|
71 | 9 | .md-checkbox:not(.md-checkbox-disabled) { |
72 | 10 | &.md-primary .md-checkbox-ripple .md-ripple-foreground { |
|
0 commit comments