![]() |
Hoinăreală |
![]() |
||||||||
|
<?php
function randomcolor()
{
$myrandomcolor = "#";
for ($i=1; $i<=3; $i++)
{
$x = rand(0,255);
$x = dechex($x);
$x = strtoupper($x);
if (strlen($x) == 1)
{
$x = "0".$x;
}
$myrandomcolor .= $x;
}
return $myrandomcolor;
}
$color_backgr=randomcolor();
$nrcolor_backgr=preg_replace("/[^0-9,^A-Z]/","",$color_backgr);
$nrc=hexdec($nrcolor_backgr);
$r=$nrc >> 16 & 0xff;
$g=$nrc >> 8 & 0xff;
$b=$nrc & 0xff;
$rc=$r ^ 0xff;
$gc=$g ^ 0xff;
$bc=$b ^ 0xff;
$oppositeColor=( $rc << 16 ) | ( $gc << 8 ) | $bc;
$oppositeColor="#".substr("000000".dechex($oppositeColor),-6);
$color_text=$oppositeColor;
echo $color_text;
?>
Copyright © 2021; All right reserved Hoinăreală. |