Recently, I've been using a color picker from jscolor.com that outputs colors in the format of FFA6A6. The challenge I'm facing is integrating this color output with three.js, which requires the color to be in the format of 0xFFA6A6. As much as I try, I can't seem to figure out how to make this conversion without turning it into a string.
For example, I need to change "FFA6A6" to FFA6A6 in order for three.js to recognize it properly. Below is the code snippet showing my attempts:
function updateNoseColor(){
scene.remove(nose);
var geometry = new THREE.ConeGeometry( .4, 1, 32 );
var material = new THREE.MeshBasicMaterial( {color: document.getElementById("nosecolor").value} );
//I'm struggling with converting the color value to meet three.js requirements
var nose = new THREE.Mesh( geometry, material );
scene.add(nose);
}
I appreciate your time and expertise in helping me find a solution to this issue. If there's a simple way to remove quotes and add '0x', please let me know. Thank you!
EDIT: I attempted using ParseInt to convert to decimal, but unfortunately, it was not accepted by three.js.