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 i = 0; i < count; i++) {
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()




Reply With Quote