diff default/assets/scss/vendors/bourbon/validators/_is-light.scss @ 0:1d038bc9b3d2 default tip

Up:default
author Liny <dev@neowd.com>
date Sat, 31 May 2025 09:21:51 +0800
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/assets/scss/vendors/bourbon/validators/_is-light.scss	Sat May 31 09:21:51 2025 +0800
@@ -0,0 +1,23 @@
+@charset "UTF-8";
+
+/// Programatically determines whether a color is light or dark.
+///
+/// @link http://goo.gl/Dil4Y9
+///
+/// @argument {color (hex)} $hex-color
+///
+/// @return {boolean}
+///
+/// @example scss
+///   is-light($color)
+///
+/// @access private
+
+@function _is-light($hex-color) {
+  $-local-red: red(rgba($hex-color, 1));
+  $-local-green: green(rgba($hex-color, 1));
+  $-local-blue: blue(rgba($hex-color, 1));
+  $-local-lightness: ($-local-red * 0.2126 + $-local-green * 0.7152 + $-local-blue * 0.0722) / 255;
+
+  @return $-local-lightness > 0.6;
+}