Permalink
Browse files

#14 Using compass' compact() function to remove the default false sha…

…dows before using compass' text-shadow function.
  • Loading branch information...
1 parent 6673875 commit 371f34a5c7bf0019b7c9da658bf0db2d34fe08db @heygrady committed Jun 26, 2013
Showing with 54 additions and 54 deletions.
  1. +54 −54 _jquery.textshadow.scss
@@ -29,69 +29,69 @@
}
@mixin jquery-text-shadow($shadow-1: default, $shadow-2: false, $shadow-3: false, $shadow-4: false, $shadow-5: false, $shadow-6: false, $shadow-7: false, $shadow-8: false, $shadow-9: false, $shadow-10: false) {
- // for supported browers
- @include text-shadow($shadow-1, $shadow-2, $shadow-3, $shadow-4, $shadow-5, $shadow-6, $shadow-7, $shadow-8, $shadow-9, $shadow-10);
-
@if $shadow-1 == default {
$shadow-1: $default-text-shadow-color $default-text-shadow-h-offset $default-text-shadow-v-offset $default-text-shadow-blur;
}
- $shadows: ($shadow-1, $shadow-2, $shadow-3, $shadow-4, $shadow-5, $shadow-6, $shadow-7, $shadow-8, $shadow-9, $shadow-10);
+
+ $shadows: compact($shadow-1, $shadow-2, $shadow-3, $shadow-4, $shadow-5, $shadow-6, $shadow-7, $shadow-8, $shadow-9, $shadow-10);
+
+ // for supported browsers
+ @include text-shadow($shadows...);
+
$i: 1;
@each $shadow in $shadows {
- @if $shadow {
- $length: length($shadow);
-
- // some defaults
- $color: inherit;
- $opacity: 100;
- $offset-x: 0;
- $offset-y: 0;
- $blur-radius: 0;
- $spread: 0; // IE10 only, not used
+ $length: length($shadow);
+
+ // some defaults
+ $color: inherit;
+ $opacity: 100;
+ $offset-x: 0;
+ $offset-y: 0;
+ $blur-radius: 0;
+ $spread: 0; // IE10 only, not used
- // pull apart the individual arguments from the list
- @if type-of(nth($shadow, 1)) == color {
- // color first, blur optional, spread optional
- @if $length >= 1 { $color: nth($shadow, 1); }
- @if $length >= 2 { $offset-x: nth($shadow, 2); }
- @if $length >= 3 { $offset-y: nth($shadow, 3); }
- @if $length >= 4 { $blur-radius: nth($shadow, 4); }
- @if $length == 5 { $spread: nth($shadow, 5); }
- } @else {
- // color last or missing, blur optional, spread optional
- @if type-of(nth($shadow, $length)) == color {
- $color: nth($shadow, $length);
- }
- @if $length >= 1 { $offset-x: nth($shadow, 1); }
- @if $length >= 2 { $offset-y: nth($shadow, 2); }
- @if $length >= 3 {
- @if type-of(nth($shadow, 3)) != color { $blur-radius: nth($shadow, 3); }
- }
- @if $length >= 4 {
- @if type-of(nth($shadow, 4)) != color { $spread: nth($shadow, 4); }
- }
+ // pull apart the individual arguments from the list
+ @if type-of(nth($shadow, 1)) == color {
+ // color first, blur optional, spread optional
+ @if $length >= 1 { $color: nth($shadow, 1); }
+ @if $length >= 2 { $offset-x: nth($shadow, 2); }
+ @if $length >= 3 { $offset-y: nth($shadow, 3); }
+ @if $length >= 4 { $blur-radius: nth($shadow, 4); }
+ @if $length == 5 { $spread: nth($shadow, 5); }
+ } @else {
+ // color last or missing, blur optional, spread optional
+ @if type-of(nth($shadow, $length)) == color {
+ $color: nth($shadow, $length);
}
-
- // seperate the color from the opacity
- @if $color != inherit {
- $opacity: round(alpha($color) * 100);
- $color: rgb(red($color), green($color), blue($color));
+ @if $length >= 1 { $offset-x: nth($shadow, 1); }
+ @if $length >= 2 { $offset-y: nth($shadow, 2); }
+ @if $length >= 3 {
+ @if type-of(nth($shadow, 3)) != color { $blur-radius: nth($shadow, 3); }
}
-
- // remove the unit from the radius
- @if unit($blur-radius) == px {
- $blur-radius: $blur-radius / 1px;
- }
-
- // for the jquery text-shadow plugin
- .ui-text-shadow-copy-#{$i} {
- color: $color;
- filter: if( $opacity < 100, unquote("progid:DXImageTransform.Microsoft.Alpha(Opacity=#{$opacity})"), unquote("") )
- if( $blur-radius > 0, unquote("progid:DXImageTransform.Microsoft.Blur(makeShadow=false,pixelRadius=#{$blur-radius})"), unquote("") );
- left: $offset-x - $blur-radius;
- top: $offset-y - $blur-radius;
+ @if $length >= 4 {
+ @if type-of(nth($shadow, 4)) != color { $spread: nth($shadow, 4); }
}
- $i: $i + 1;
}
+
+ // separate the color from the opacity
+ @if $color != inherit {
+ $opacity: round(alpha($color) * 100);
+ $color: rgb(red($color), green($color), blue($color));
+ }
+
+ // remove the unit from the radius
+ @if unit($blur-radius) == px {
+ $blur-radius: $blur-radius / 1px;
+ }
+
+ // for the jQuery text-shadow plug-in
+ .ui-text-shadow-copy-#{$i} {
+ color: $color;
+ filter: if( $opacity < 100, unquote("progid:DXImageTransform.Microsoft.Alpha(Opacity=#{$opacity})"), unquote("") )
+ if( $blur-radius > 0, unquote("progid:DXImageTransform.Microsoft.Blur(makeShadow=false,pixelRadius=#{$blur-radius})"), unquote("") );
+ left: $offset-x - $blur-radius;
+ top: $offset-y - $blur-radius;
+ }
+ $i: $i + 1;
}
}

0 comments on commit 371f34a

Please sign in to comment.