Skip to content

Instantly share code, notes, and snippets.

@emptyflask
Created June 18, 2010 18:04
Show Gist options
  • Save emptyflask/443984 to your computer and use it in GitHub Desktop.
Save emptyflask/443984 to your computer and use it in GitHub Desktop.
SASS mult() function
module Sass::Script::Functions
def mult(color1, color2)
c1 = color1.rgb.map { |c| c / 255.0 }
c2 = color2.rgb.map { |c| c / 255.0 }
Sass::Script::Color.new(c1.zip(c2).map { |a,b| (a*b*255).to_i })
end
end
@emptyflask
Copy link
Author

tr.active.odd td
  background-color: mult($odd, $highlight_color)
tr.active.even td
  background-color: mult($even, $highlight_color)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment