You need to convert the color to RGB, make additions and convert back:
// Convert string to 3 decimal values (0-255) $rgb = array_map('hexdec', str_split("cc6699", 2)); // Modify color $rgb[0] += 34; $rgb[1] += 34; $rgb[2] += 17; // Convert back $result = implode('', array_map('dechex', $rgb)); echo $result;
See here in action .
source share