Created
June 24, 2012 17:40
-
-
Save nathggns/2984123 to your computer and use it in GitHub Desktop.
Text Stroke SCSS Mixin (SASS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin stroke($width, $color) { | |
$shadow: 0 0 0 transparent; | |
$i: 0; | |
@while ($i < $width) { | |
$i: $i + 1; | |
$j: 0; | |
@while ($j < 2) { | |
$j: $j + 1; | |
@for $k from 1 through 3 { | |
$x: 0; | |
$y: 0; | |
@if ($k == 1) { | |
$x: $i; | |
} | |
@if ($k == 2) { | |
$y: $i; | |
} | |
@if ($k == 3) { | |
$x: $i; | |
$y: $i; | |
} | |
@if ($j != 1) { | |
$x: $x * (0 - 1); | |
$y: $y * (0 - 1); | |
} | |
$shadow: #{$shadow}, #{$x}px #{$y}px 0 $color; | |
} | |
} | |
} | |
text-shadow: $shadow; | |
@media screen and (-webkit-min-device-pixel-ratio: 0) { | |
text-shadow: none; | |
-webkit-text-stroke: #{$width}px $color; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone, who will search for
text-stroke
mixin for LESS:Usage: