Thanks Mislav. I considered just using rgba rather than hexa, but with rgba, it is suggesting that rgb values should be used. If you feed in a hex or keyword argument, then it doesn't make sense. Perhaps colora() or cola() is a better alternative?
2010/1/26 Mislav Marohnić <[email protected]>: > 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 <[email protected]> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/haml?hl=en. > -- You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
