Skip to content

Commit

Permalink
add support for linear-gradient(stops...). Closes #110
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Jul 5, 2012
1 parent 2309719 commit 7701921
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/nib/gradients.styl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ linear-gradient(start, stops...)
error('color stops required') unless length(stops)
prop = current-property[0]
val = current-property[1]

if start is a 'color'
unshift(stops, start)
start = top

stops = normalize-stops(stops)

// gradient image
Expand Down
8 changes: 8 additions & 0 deletions test/cases/linear-gradient.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ body {
background: -ms-linear-gradient(top, #fff 0%, #000 100%);
background: linear-gradient(top, #fff 0%, #000 100%);
}
body {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #000));
background: -webkit-linear-gradient(top, #fff 0%, #000 100%);
background: -moz-linear-gradient(top, #fff 0%, #000 100%);
background: -o-linear-gradient(top, #fff 0%, #000 100%);
background: -ms-linear-gradient(top, #fff 0%, #000 100%);
background: linear-gradient(top, #fff 0%, #000 100%);
}
body {
background: -webkit-gradient(linear, left top, right bottom, color-stop(0, #fff), color-stop(0.25, #f00), color-stop(0.5, #00f), color-stop(1, #000));
background: -webkit-linear-gradient(top left, #fff 0%, #f00 25%, #00f 50%, #000 100%);
Expand Down
3 changes: 3 additions & 0 deletions test/cases/linear-gradient.styl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

@import 'nib/gradients'

body
background: linear-gradient(white, black)

body
background: linear-gradient(top, white, black)

Expand Down

1 comment on commit 7701921

@rauchg
Copy link
Contributor

@rauchg rauchg commented on 7701921 Jul 5, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hotness

Please sign in to comment.