How about simply creating a function called rgba(). This is what I'm using
in Haml 2.2.x (probably will not work with newer!)

  module Sass::Script::Functions
    def rgba(color, opacity)
      values = color.value + [opacity]
      Sass::Script::String.new('rgba(%d,%d,%d,%s)' % values)
    end
  end

Here are some mixins for CSS features I'm heavily using rgba for:

  =box-shadow(!params)
    :box-shadow = !params
    :-webkit-box-shadow = !params
    :-moz-box-shadow = !params

  =gradient(!from, !to)
    :background-image = "-webkit-gradient(linear, left top, left bottom,
from(#{!from}), to(#{!to}))"
    :background-image = "-moz-linear-gradient(#{!from}, #{!to})"
  =gradient-top(!color, !alpha = 1)
    +gradient(rgba(!color,!alpha), rgba(!color,0))
  =gradient-bottom(!color, !alpha = 1)
    +gradient(rgba(!color,0), rgba(!color,!alpha))


Example of using the mixins:

  .signup-button
    +gradient-top(white, .3)
    +box-shadow(rgba(black, .2) 0 0 6px)

Notice how I'm using color names here. I could be using anything that Sass
recognizes as color value, including hex forms.


On Mon, Jan 25, 2010 at 21:26, Nathan Weizenbaum <nex...@gmail.com> wrote:

> I've been considering adding a shorter version of rgba() that takes a hex
> color. File an issue and I'll get around to it.

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to h...@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to