2d3ca553 |
1 | @charset "UTF-8"; |
2 | |
3 | /// Performs gamma correction on a single color channel. |
4 | /// |
5 | /// Note that the calculation is approximate if a `pow()` is not available. |
6 | /// |
7 | /// @argument {number (0-1)} $channel |
8 | /// |
9 | /// @return {number (0-1)} |
10 | /// |
11 | /// @access private |
12 | |
13 | @function _gamma($channel) { |
14 | @if $channel < 0.03928 { |
15 | @return $channel / 12.92; |
16 | } @else { |
17 | $c: ($channel + 0.055) / 1.055; |
18 | @if function-exists("pow") { |
19 | @return pow($c, 2.4); |
20 | } @else { |
21 | @return 0.56 * $c * $c * $c + 0.44 * $c * $c; |
22 | } |
23 | } |
24 | } |