| 1 |
@charset "UTF-8"; |
| 2 |
|
| 3 |
/// Programatically determines whether a color is light or dark. |
| 4 |
/// |
| 5 |
/// @link http://robots.thoughtbot.com/closer-look-color-lightness |
| 6 |
/// |
| 7 |
/// @param {Color (Hex)} $color |
| 8 |
/// |
| 9 |
/// @example scss - Usage |
| 10 |
/// is-light($color) |
| 11 |
/// |
| 12 |
/// @return {Bool} |
| 13 |
|
| 14 |
@function is-light($hex-color) { |
| 15 |
@if $output-bourbon-deprecation-warnings == true { |
| 16 |
@warn "[Bourbon] [Deprecation] `is-light` is deprecated and will be " + |
| 17 |
"removed in 5.0.0."; |
| 18 |
} |
| 19 |
|
| 20 |
$-local-red: red(rgba($hex-color, 1)); |
| 21 |
$-local-green: green(rgba($hex-color, 1)); |
| 22 |
$-local-blue: blue(rgba($hex-color, 1)); |
| 23 |
$-local-lightness: ($-local-red * 0.2126 + $-local-green * 0.7152 + $-local-blue * 0.0722) / 255; |
| 24 |
|
| 25 |
@return $-local-lightness > 0.6; |
| 26 |
} |