|
7 | 7 | $accent: map-get($theme, accent); |
8 | 8 | $warn: map-get($theme, warn); |
9 | 9 |
|
10 | | - // TODO(josephperrott): Find better way to inline svgs. |
11 | | - // In buffer mode a repeated SVG object is used as a background. |
12 | | - // Each of the following defines the SVG object for each of the class defined colors. |
13 | | - // |
14 | | - // Each string is a URL encoded version of: |
15 | | - // |
16 | | - // <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" |
17 | | - // version="1.1" x="0px" y="0px" enable-background="new 0 0 5 2" |
18 | | - // xml:space="preserve" viewBox="0 0 5 2" preserveAspectRatio="none slice"> |
19 | | - // <circle cx="1" cy="1" r="1" fill="{INJECTED_COLOR}"/> |
20 | | - // </svg> |
21 | | - // |
22 | | - $buffer-bubbles-primary-url: url( |
23 | | - 'data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%271.1%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27' + |
24 | | - '%20xmlns%3Axlink%3D%27http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%27%20x%3D%270px%27%20y%3D%270px%27%20enable-backgroun' + |
25 | | - 'd%3D%27new%200%200%205%202%27%20xml%3Aspace%3D%27preserve%27%20viewBox%3D%270%200%205%202%27%20preserveAspectRatio' + |
26 | | - '%3D%27none%20slice%27%3E%3Ccircle%20cx%3D%271%27%20cy%3D%271%27%20r%3D%271%27%20fill%3D%27' + |
27 | | - md-color($primary, 100) + '%27%2F%3E%3C%2Fsvg%3E') !default; |
28 | | - $buffer-bubbles-accent-url: url( |
29 | | - 'data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%271.1%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27' + |
30 | | - '%20xmlns%3Axlink%3D%27http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%27%20x%3D%270px%27%20y%3D%270px%27%20enable-backgroun' + |
31 | | - 'd%3D%27new%200%200%205%202%27%20xml%3Aspace%3D%27preserve%27%20viewBox%3D%270%200%205%202%27%20preserveAspectRatio' + |
32 | | - '%3D%27none%20slice%27%3E%3Ccircle%20cx%3D%271%27%20cy%3D%271%27%20r%3D%271%27%20fill%3D%27' + |
33 | | - md-color($accent, 100) + '%27%2F%3E%3C%2Fsvg%3E') !default; |
34 | | - $buffer-bubbles-warn-url: url( |
35 | | - 'data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%271.1%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27' + |
36 | | - '%20xmlns%3Axlink%3D%27http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%27%20x%3D%270px%27%20y%3D%270px%27%20enable-backgroun' + |
37 | | - 'd%3D%27new%200%200%205%202%27%20xml%3Aspace%3D%27preserve%27%20viewBox%3D%270%200%205%202%27%20preserveAspectRatio' + |
38 | | - '%3D%27none%20slice%27%3E%3Ccircle%20cx%3D%271%27%20cy%3D%271%27%20r%3D%271%27%20fill%3D%27' + |
39 | | - md-color($warn, 100) + '%27%2F%3E%3C%2Fsvg%3E') !default; |
40 | | - |
41 | 10 | .md-progress-bar-background { |
42 | | - background: $buffer-bubbles-primary-url; |
| 11 | + background: #{_md-progress-bar-buffer($primary, 100)}; |
43 | 12 | } |
44 | | - |
| 13 | + |
45 | 14 | .md-progress-bar-buffer { |
46 | 15 | background-color: md-color($primary, 100); |
47 | 16 | } |
48 | | - |
| 17 | + |
49 | 18 | md-progress-bar[color='accent'] { |
50 | 19 | .md-progress-bar-background { |
51 | | - background: $buffer-bubbles-accent-url; |
| 20 | + background: #{_md-progress-bar-buffer($accent, 100)}; |
52 | 21 | } |
53 | | - |
| 22 | + |
54 | 23 | .md-progress-bar-buffer { |
55 | 24 | background-color: md-color($accent, 100); |
56 | 25 | } |
57 | 26 | .md-progress-bar-fill::after { |
58 | 27 | background-color: md-color($accent, 600); |
59 | 28 | } |
60 | 29 | } |
61 | | - |
| 30 | + |
62 | 31 | md-progress-bar[color='warn'] { |
63 | 32 | .md-progress-bar-background { |
64 | | - background: $buffer-bubbles-warn-url; |
| 33 | + background: #{_md-progress-bar-buffer($warn, 100)}; |
65 | 34 | } |
66 | | - |
| 35 | + |
67 | 36 | .md-progress-bar-buffer { |
68 | 37 | background-color: md-color($warn, 100); |
69 | 38 | } |
|
76 | 45 | background-color: md-color($primary, 600); |
77 | 46 | } |
78 | 47 | } |
| 48 | + |
| 49 | +// TODO(josephperrott): Find better way to inline svgs. |
| 50 | +// In buffer mode a repeated SVG object is used as a background. |
| 51 | +// Each of the following defines the SVG object for each of the class defined colors. |
| 52 | +// |
| 53 | +// The string is a URL encoded version of: |
| 54 | +// |
| 55 | +// <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" |
| 56 | +// version="1.1" x="0px" y="0px" enable-background="new 0 0 5 2" |
| 57 | +// xml:space="preserve" viewBox="0 0 5 2" preserveAspectRatio="none slice"> |
| 58 | +// <circle cx="1" cy="1" r="1" fill="{INJECTED_COLOR}"/> |
| 59 | +// </svg> |
| 60 | +@function _md-progress-bar-buffer($palette, $hue) { |
| 61 | + $result: '' + |
| 62 | + 'data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%271.1%27%20xmlns%3D%27http%3A%2F%2F' + |
| 63 | + 'www.w3.org%2F2000%2Fsvg%27%20xmlns%3Axlink%3D%27http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%2' + |
| 64 | + '7%20x%3D%270px%27%20y%3D%270px%27%20enable-background%3D%27new%200%200%205%202%27%20xml%' + |
| 65 | + '3Aspace%3D%27preserve%27%20viewBox%3D%270%200%205%202%27%20preserveAspectRatio%3D%27none' + |
| 66 | + '%20slice%27%3E%3Ccircle%20cx%3D%271%27%20cy%3D%271%27%20r%3D%271%27%20fill%3D%27' + |
| 67 | + md-color($palette, $hue) + '%27%2F%3E%3C%2Fsvg%3E'; |
| 68 | + |
| 69 | + @return url($result); |
| 70 | +} |
0 commit comments