Skip to content

Instantly share code, notes, and snippets.

@imathis
Created November 21, 2009 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save imathis/240199 to your computer and use it in GitHub Desktop.
Save imathis/240199 to your computer and use it in GitHub Desktop.
=gradient(!type, !coords, !color_start, !color_end, !color_stop = false)
!gradient= "#{!coords}, from(#{!color_start}), to(#{!color_end})"
@if !color_stop
!gradient= !gradient + ", " + !color_stop
background: -webkit-gradient(#{!type}, #{!gradient})
background: -moz-#{!type}-gradient(#{!gradient})
//*
Creates a radial gradient
Usage example:
// This will yeild a radial gradient with an apparent specular highlihgt
+gradient("45 45, 10, 52 50, 30" from(Cyan), to(DodgerBlue), color-stop(90%, DeepSkyBlue))
=radial-gradient(!coords, !color1, !color2, !color_stop = false)
+gradient("radial", !coords, !color1, !color2, !color_stop)
=linear-gradient(!start, !end, !color1, !color2, !color_stop = false)
!coords = !start + ", " + !end
+gradient("linear", !coords, !color1, !color2, !color_stop)
//*
Creates a vertical linear gradient.
Usage examples:
// yields a gradient starting at the top with #fff, ending in #aaa
+v-gradient(#fff, #aaa)
// same as above but with a #ccc at the halfway point
+v-gradient(#fff, #aaa, color-stop(50%, #ccc))
// same as the first example but with #ccc at the 30% from the top, and #bbb at 70% from the top
+v-gradient(#fff, #aaa, color-stop(30%, #ccc, 70%, #bbb))
=v-gradient(!color1, !color2, !color_stop = false)
=linear-gradient("left top", "left bottom", !color1, !color2, !color_stop)
//* yields a horizontal linear gradient spanning from left to right
=h-gradient(!color1, !color2, !color_stop = false)
=linear-gradient("left top", "right top", !color1, !color2, !color_stop)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment