In the three.js documentation, it states that three.js is the recommended form for inputting colors. However, I’m noticing 8 digits instead of 6. Can someone provide the background and conversion on this? I can’t seem to find much information online.
Is it safe to assume “0x” is placed before every hexa code?
so, just place the 0x before every hexadecimal number?
With regards to Hex colors, it works the same way as CSS colors - the first two digits (first byte) after 0x is the red component, seconds two digits is the green and the last two digits is the blue.
So you should think of it as three separate numbers in one:
0x 00 00 00: hex red(0) green(0) blue(0)
0x 01 01 01: hex red(1) green(1) blue(1)
0x ff ff ff: hex red(255) green(255) blue(255)
CSS colors will start with # - so #ffffff (white) in CSS is equivalent to 0xffffff in three.js.