Hello right now I have a task to do but I am kind of stuck with the color bit. I am working with three.js (a javascript library). In the task at a certain point, I need to convert decimal color code (eg 12615680
into something like this: #FF0000
or 0xFF0000
. The solution should be javascript code (function) which can convert the decimal color to hex.
In three.js, you can use this pattern to convert a decimal color to a hex string:
var c = new THREE.Color(); // create once and reuse
c.set( 12615680 );
c.getHexString(); // "c08000"
three.js r.89
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.