|
12 | 12 | /// @param {*} $as-float [false] If true, return the value as a float between 0 and 1
|
13 | 13 |
|
14 | 14 | @function rgb-red($color, $as-float: false) {
|
15 |
| - $v: color.channel($color, 'red', $space: rgb); |
| 15 | + $v: null; |
| 16 | + @if (function-exists('color.channel')) { |
| 17 | + $v: color.channel($color, 'red', $space: rgb); |
| 18 | + } @else { |
| 19 | + $v: color.red($color); |
| 20 | + } |
16 | 21 | @return if($as-float, divide($v, 255), $v);
|
17 | 22 | }
|
18 | 23 |
|
|
21 | 26 | /// @param {*} $as-float [false] If true, return the value as a float between 0 and 1
|
22 | 27 |
|
23 | 28 | @function rgb-green($color, $as-float: false) {
|
24 |
| - $v: color.channel($color, 'green', $space: rgb); |
| 29 | + $v: null; |
| 30 | + @if (function-exists('color.channel')) { |
| 31 | + $v: color.channel($color, 'green', $space: rgb); |
| 32 | + } @else { |
| 33 | + $v: color.green($color); |
| 34 | + } |
25 | 35 | @return if($as-float, divide($v, 255), $v);
|
26 | 36 | }
|
27 | 37 |
|
|
30 | 40 | /// @param {*} $as-float [false] If true, return the value as a float between 0 and 1
|
31 | 41 |
|
32 | 42 | @function rgb-blue($color, $as-float: false) {
|
33 |
| - $v: color.channel($color, 'blue', $space: rgb); |
| 43 | + $v: null; |
| 44 | + @if (function-exists('color.channel')) { |
| 45 | + $v: color.channel($color, 'blue', $space: rgb); |
| 46 | + } @else { |
| 47 | + $v: color.blue($color); |
| 48 | + } |
34 | 49 | @return if($as-float, divide($v, 255), $v);
|
35 | 50 | }
|
36 | 51 |
|
|
0 commit comments