summaryrefslogtreecommitdiff
path: root/_sass/bourbon/functions/_is-light.scss
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2024-02-08 16:36:31 -0600
committerHombreLaser <sebastian-440@live.com>2024-02-08 16:36:31 -0600
commite182245d3205d929881f51da9b48d6c4ed97a682 (patch)
treed390e8754dec70a9c9293afb801321b96f043c15 /_sass/bourbon/functions/_is-light.scss
Commit inicialHEADmaster
Diffstat (limited to '_sass/bourbon/functions/_is-light.scss')
-rw-r--r--_sass/bourbon/functions/_is-light.scss21
1 files changed, 21 insertions, 0 deletions
diff --git a/_sass/bourbon/functions/_is-light.scss b/_sass/bourbon/functions/_is-light.scss
new file mode 100644
index 0000000..92d90ac
--- /dev/null
+++ b/_sass/bourbon/functions/_is-light.scss
@@ -0,0 +1,21 @@
+@charset "UTF-8";
+
+/// Programatically determines whether a color is light or dark.
+///
+/// @link http://robots.thoughtbot.com/closer-look-color-lightness
+///
+/// @param {Color (Hex)} $color
+///
+/// @example scss - Usage
+/// is-light($color)
+///
+/// @return {Bool}
+
+@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;
+}