Maybe someone met ready?
For example, we give the input 006a44, we get 00ce44.
Ie the same color, only lighter ... Theoretically, there is nothing complicated, we translate the color into a 10-bit color, and increase the middle (G), for example, by 100, if it is already a maximum of 255 or more than 200, then we increase the first ( R).
But I have more trouble transferring their 16 to the 10th system.
function lighter($color) { $x1 = dechex($color[0] . $color[1]); $x2 = dechex($color[2] . $color[3]); $x3 = dechex($color[4] . $color[5]); if ($x2 > 220) { // некуда осветлять if ($x1 + 150 > 255) { $x1 = 255; } else { $x1 = $x1 + 100; } } else { $x2 = $x2 + 100; } return hexdec($x1) . hexdec($x2) . hexdec($x3); }
But he does not always correctly translate into 10 or 16, since sometimes 3-digit values skip and the resulting color consists of 7 characters.