From d6c7509a05e8adc8f60acfbe95752d72958b29e3 Mon Sep 17 00:00:00 2001 From: redVi Date: Fri, 12 Aug 2016 22:10:37 +0700 Subject: [PATCH] Shade by Stylus --- stylus/shade.styl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 stylus/shade.styl diff --git a/stylus/shade.styl b/stylus/shade.styl new file mode 100644 index 0000000..81b87da --- /dev/null +++ b/stylus/shade.styl @@ -0,0 +1,22 @@ +shade($type = text, $color = #3498db, $depth = 50, $angle = 145deg, $long = false, $fade = false) + $angle = $angle - 90 + $x = 1.5 * cos($angle) + 0px + $y = 1.5 * sin($angle) + 0px + $darken = lightness($color / $depth / 2) + $opacify = 0 + $shadow = () + + if $long == true + {$darken}: 0 + + if $fade == true + {$opacify}: opacity($color / $depth) + + for $i in (1..$depth) + $properties = $i * $x $i * $y 0 hsla(hue($color), saturation($color), lightness($color) - $i * $darken, 1 - $i * $opacify) + if $i > 1 + $shadow = $shadow, $properties + else + $shadow = $shadow $properties + + {$type}-shadow: $shadow