Created
July 6, 2017 08:31
-
-
Save Maden-maxi/262345ad1e93e489016af5e9adb3b1b6 to your computer and use it in GitHub Desktop.
Revisions
-
Maden-maxi created this gist
Jul 6, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ <?php function color_inverse_rgb($color){ $rgb = trim( $color ); if( strrpos($rgb, 'rgb') ){ $rgb = str_replace('rgb(', '', $rgb); $rgb = str_replace(')','',$rgb); $rgb_array = explode(',',$rgb); foreach ($rgb_array as $key => $rgb_color ){ $rgb_array[$key] = 255 - (int)$rgb_color; } $rgb = implode(',',$rgb_array); return 'rgb('.$rgb.')'; }else{ return $rgb; } }