|
2 | 2 | //
|
3 | 3 | // Utility mixins and functions for evaluating source code across our variables, maps, and mixins.
|
4 | 4 |
|
| 5 | +@use "sass:color"; |
| 6 | +@use "sass:math"; |
| 7 | + |
5 | 8 | // Ascending
|
6 | 9 | // Used to evaluate Sass maps like our grid breakpoints.
|
7 | 10 | @mixin _assert-ascending($map, $map-name) {
|
|
34 | 37 |
|
35 | 38 | // Colors
|
36 | 39 | @function to-rgb($value) {
|
37 |
| - @return red($value), green($value), blue($value); |
| 40 | + $red: math.round(color.channel($value, "red", rgb)); |
| 41 | + $green: math.round(color.channel($value, "green", rgb)); |
| 42 | + $blue: math.round(color.channel($value, "blue", rgb)); |
| 43 | + |
| 44 | + @return $red, $green, $blue; |
| 45 | + |
38 | 46 | }
|
39 | 47 |
|
40 | 48 | // stylelint-disable scss/dollar-variable-pattern
|
@@ -182,9 +190,9 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
|
182 | 190 | // See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio
|
183 | 191 | @function luminance($color) {
|
184 | 192 | $rgb: (
|
185 |
| - "r": red($color), |
186 |
| - "g": green($color), |
187 |
| - "b": blue($color) |
| 193 | + "r": math.round(color.channel($color, "red", rgb)), |
| 194 | + "g": math.round(color.channel($color, "green", rgb)), |
| 195 | + "b": math.round(color.channel($color, "blue", rgb)) |
188 | 196 | );
|
189 | 197 |
|
190 | 198 | @each $name, $value in $rgb {
|
|
0 commit comments