Created
September 28, 2011 00:12
-
-
Save mahemoff/1246629 to your computer and use it in GitHub Desktop.
gradient background (stylus)
This file contains hidden or 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
body | |
background-image linear-gradient(top, sky, 80% sky, sky*0.7) | |
background-attachment fixed | |
/////////////////////////////////////////////////////////////// | |
// from https://github.com/visionmedia/nib/blob/master/lib/nib/gradients.styl | |
linear-gradient(start, stops...) | |
error('color stops required') unless length(stops) | |
prop = current-property[0] | |
val = current-property[1] | |
stops = normalize-stops(stops) | |
// webkit | |
end = grad-point(opposite-position(start)) | |
webkit = s('-webkit-gradient(linear, %s, %s, %s)', grad-point(start), end, join-stops(stops, webkit-stop)) | |
add-property(prop, replace(val, '__CALL__', webkit)) | |
// moz | |
stops = join-stops(stops, moz-stop) | |
moz = s('-moz-linear-gradient(%s, %s)', start, stops) | |
add-property(prop, replace(val, '__CALL__', moz)) | |
// literal | |
s('linear-gradient(%s, %s)', start, stops) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment