function _color_blend
Same name in other branches
- 7.x modules/color/color.module \_color_blend()
- 8.9.x core/modules/color/color.module \_color_blend()
Blends two hex colors and returns the GD color.
1 call to _color_blend()
- _color_render_images in core/
modules/ color/ color.module - Renders images that match a given palette.
File
-
core/
modules/ color/ color.module, line 745
Code
function _color_blend($img, $hex1, $hex2, $alpha) {
$in1 = _color_unpack($hex1);
$in2 = _color_unpack($hex2);
$out = [
$img,
];
for ($i = 0; $i < 3; ++$i) {
$out[] = $in1[$i] + ($in2[$i] - $in1[$i]) * $alpha;
}
return call_user_func_array('imagecolorallocate', $out);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.