Numarul de culoare pe 8-biți este generat cu următoarea formulă:
Cod: Selectaţi tot
color = ( [red] * 65536) + ( [green] * 256) + ( [blue] * 1)
Cod: Selectaţi tot
sprintf(colorbuf, "#%6.6x", color);
Cod: Selectaţi tot
color = ( [red] * 65536) + ( [green] * 256) + ( [blue] * 1)
Cod: Selectaţi tot
sprintf(colorbuf, "#%6.6x", color);
Cod: Selectaţi tot
color.toString(16)
Cod: Selectaţi tot
// White
color = (255 * 65536) + (255 * 256) + (255 * 1); // 16777215
color.toString(16); // 'ffffff'