2d3ca553 |
1 | @charset "UTF-8"; |
2 | |
3 | /// Programatically determines the lightness of a color. |
4 | /// |
5 | /// @argument {color (hex)} $hex-color |
6 | /// |
7 | /// @return {number (0-1)} |
8 | /// |
9 | /// @example scss |
10 | /// _lightness($color) |
11 | /// |
12 | /// @access private |
13 | |
14 | @function _lightness($hex-color) { |
15 | $-local-red-raw: red(rgba($hex-color, 1)); |
16 | $-local-green-raw: green(rgba($hex-color, 1)); |
17 | $-local-blue-raw: blue(rgba($hex-color, 1)); |
18 | |
19 | $-local-red: _gamma($-local-red-raw / 255); |
20 | $-local-green: _gamma($-local-green-raw / 255); |
21 | $-local-blue: _gamma($-local-blue-raw / 255); |
22 | |
23 | @return $-local-red * 0.2126 + $-local-green * 0.7152 + $-local-blue * 0.0722; |
24 | } |