Generate list of all Decimal colors

Discussion in 'PHP' started by rmfphoto, Nov 5, 2008.

  1. #1
    anyone know a way to generate a list of every single hex color?
     
    rmfphoto, Nov 5, 2008 IP
  2. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    this will work, might crash your browser though:

    
    $dec = 0;
    $hex = 0;
    
    while ($hex <= FFFFFF)
    {
    	$hex = dechex($dec);
    	while (strlen($hex) < 6) { $hex = "0" . $hex; }
    	echo "#".$hex."<br/>";
    	++$dec;
    }
    
    PHP:
     
    dev_SeeInside, Nov 6, 2008 IP
  3. rmfphoto

    rmfphoto Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks :) Works Great
     
    rmfphoto, Nov 6, 2008 IP