You are here

function _fivestar_color_blend in Fivestar 6

Same name and namespace in other branches
  1. 5 fivestar_color.inc \_fivestar_color_blend()
  2. 6.2 includes/fivestar.color.inc \_fivestar_color_blend()

Blend two hex colors and return the resulting hex color.

1 call to _fivestar_color_blend()
_fivestar_color_mask_linear_gradient in ./fivestar_color.inc
Apply a gradient to a portion of a black and white mask image.

File

./fivestar_color.inc, line 353
File containing functions relating to the color widget.

Code

function _fivestar_color_blend($hex1, $hex2, $alpha) {
  $in1 = _fivestar_color_unpack($hex1);
  $in2 = _fivestar_color_unpack($hex2);
  for ($i = 0; $i < 3; ++$i) {
    $out[] = $in1[$i] + ($in2[$i] - $in1[$i]) * $alpha;
  }
  return _fivestar_color_pack($out);
}