You are here

function ctools_color_blend in Chaos Tool Suite (ctools) 6

Blend two hex colors and return the GD color.

1 call to ctools_color_blend()
ctools_stylizer_image_processor::command_gradient in includes/stylizer.inc

File

includes/stylizer.inc, line 1708
Create customized CSS and images from palettes created by user input.

Code

function ctools_color_blend($img, $hex1, $hex2, $alpha) {
  $in1 = ctools_color_unpack($hex1);
  $in2 = ctools_color_unpack($hex2);
  $out = array(
    $img,
  );
  for ($i = 0; $i < 3; ++$i) {
    $out[] = $in1[$i] + ($in2[$i] - $in1[$i]) * $alpha;
  }
  return call_user_func_array('imagecolorallocate', $out);
}