20 Jun '12, 4pm

@elwoz @chriseppstein @tabatkins @fantasai there is opacify & tranparentize in Sass.

# File '/var/www/sass-pages/.sass/lib/sass/script/functions.rb', line 931 def mix(color1, color2, weight = Number.new(50)) assert_type color1, :Color assert_type color2, :Color assert_type weight, :Number Sass::Util.check_range("Weight", 0..100, weight, '%') # This algorithm factors in both the user-provided weight # and the difference between the alpha values of the two colors # to decide how to perform the weighted average of the two RGB values. # # It works by first normalizing both parameters to be within [-1, 1], # where 1 indicates "only use color1", -1 indicates "only use color 0", # and all values in between indicated a proportionately weighted average. # # Once we have the normalized variables w and a, # we apply the formula (w + a)/(1 + w*a) # to get the combined weight (in [-1, 1]) of color1. # This formula has two especially nice properties: # # * When either w...

Full article: http://sass-lang.com/docs/yardoc/Sass/Script/Functions.ht...

Tweets