Skip to content

Instantly share code, notes, and snippets.

@jakebresnehan
Forked from efedorenko/gist:2028193
Created April 20, 2012 01:16
Show Gist options
  • Save jakebresnehan/2425153 to your computer and use it in GitHub Desktop.
Save jakebresnehan/2425153 to your computer and use it in GitHub Desktop.
Function for alpha blending
// Alpha blending
@function blend($bg, $fg) {
$r: red($fg) * alpha($fg) + red($bg) * (1 - alpha($fg));
$g: green($fg) * alpha($fg) + green($bg) * (1 - alpha($fg));
$b: blue($fg) * alpha($fg) + blue($bg) * (1 - alpha($fg));
@return rgb($r, $g, $b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment