Random color generation using PHP

前端 未结 13 1733
终归单人心
终归单人心 2020-12-14 09:48

I\'m trying to generate random HTML colors in PHP, but I\'m having trouble getting them to look similar, or in the same family. Is there some function I can use to generate

相关标签:
13条回答
  • 2020-12-14 10:54

    you can make your own function which will generate your own rgb color

    http://sandbox.phpcode.eu/g/bf2a5/1

    <?php  
    function gen(){ 
        for($i=1;$i<200;$i++){ 
           echo "<div style='color:rgb($i,$i,0);'>hello</div>"; 
        } 
    } 
    
    gen(); 
    ?>
    

    or bgcolor

    http://sandbox.phpcode.eu/g/bf2a5/2

    <?php  
    function gen(){ 
        for($i=1;$i<200;$i++){ 
           echo "<div style='background-color:rgb($i,$i,0);'>hello</div>"; 
        } 
    } 
    
    gen(); 
    ?>
    
    0 讨论(0)
提交回复
热议问题