A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Script to determine 100 neutral grey hex values between #000000 and #FFFFFF

Threaded View

  1. #4
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    well here is the port, I can see the first color is black and the next color showed up as greyer.



    PHP Code:


    //<div id="palette"></div>

    function shadesOfGrey() {
    var 
    count 100;
    for (var 
    0counti++) {
    var 
    float = (255 / (count 1)) * i;
    var 
    intt Math.floor(float);
    var 
    hex = (intt).toString(16);
    if (
    intt 16 ) { hex '0'+hex; }
    var 
    color hex+hex+hex;
    trace(i" " float" " intt" " hex" " color);
    //let parent = document.getElementById('palette');
    //parent.insertAdjacentHTML('beforeend', '<div style="background-color:#'+color+'">'+color+'</div>');
    }
    }


    shadesOfGrey() 
    Last edited by AS3.0; 04-18-2021 at 06:12 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center