Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trevorgreenleaf/3463efa8b38dc6f727d45f2896816856 to your computer and use it in GitHub Desktop.
Save trevorgreenleaf/3463efa8b38dc6f727d45f2896816856 to your computer and use it in GitHub Desktop.
Colors with Decimals and Hex as an array
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<?php
function toColor($n){
return("#".substr("000000".dechex($n),-6));
}
echo $color2 = toColor(47020);
$color_options = array('',','',','','');
$c1 = 'FF';
$c2 = '00';
$c3 = '00';
$color = '#'.$c1.$c2.$c3;
echo '<body style="background-color:'.$color2.';"></body>';
?>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment