Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function conversion($color, $param) {
- $r = substr($color, 1, 2);
- $g = substr($color, 3, 2);
- $b = substr($color, 5, 2);
- $r = hexdec($r);
- $g = hexdec($g);
- $b = hexdec($b);
- if ($newR >= $param) {$newR = $r - $param;} else if ($newR <= 255) {$newR = $r + $param;}
- if ($newG >= $param) {$newG = $g - $param;} else if ($newG <= 255) {$newG = $g + $param;}
- if ($newB >= $param) {$newB = $b - $param;} else if ($newB <= 255) {$newB = $b + $param;}
- $newR = dechex($newR);
- $newG = dechex($newG);
- $newB = dechex($newB);
- return "#" . $newR . $newG . $newB;
- }
- echo conversion('#0073aa', 10); //resultado #a7db4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement