So I have a color picker, which outputs colors in this format: FFA6A6. It is a plugin from jscolor.com. I am using three.js to change the color of something live when I change it with the color picker. However, three.js takes 0xFFA6A6, not just that. On top of that, I can not concatenate 0x to FFA6A6, which would make it a string. Also, it outputs colors as a string, and I cannot seem to remove it from being a string
ex:"FFA6A6" to FFA6A6
How would I change FFA6A6 to something that can be recognized as a three.js color? This is what I have:
function updateNoseColor(){
scene.remove(nose);
var geometry = new THREE.ConeGeometry( .4, 1, 32 );
var material = new THREE.MeshBasicMaterial( {color: document.getElementById("nosecolor").value} );
//three.js cannot take a string as a value, so im not sure what to do
var nose = new THREE.Mesh( geometry, material );
scene.add(nose);
}
Thank you for your time, there is probably an extremely simple solution that I do not know of. Again, the problem is removing the quotes, and adding it to 0x
Thanks!
EDIT: I have tried converting to a decimal with ParseInt, it is not accepted by three.js
parseInt, just make sure you include the0xin front.0xFFF === parseInt('0xFFF')will evaluate to true.