I have a mesh that I create and color according to user specifications using an HTML5 color picker. To retrieve the color value from the color picker, I use the following code: var colorChosen = $("#colorAgent").val() // it returns the value as: "#ff0080" ;
After removing the "#" symbol, I convert it to hex code like this: colorChosen = "0xff0080" However, when I try to use the code below to apply the color to the mesh
var material = new THREE.MeshBasicMaterial({ color: colorChosen , wireframe_linewidth: 80, vertexColors: THREE.FaceColors, wireframe: false, opacity: 0.8, transparent: true, side: THREE.DoubleSide, visible: true });
It doesn't correctly apply the color, but if I remove the quotes from the colorChosen variable (i.e. colorChosen = 0xff00) it does apply the color.
Please advise on how to remove the quotes in order to properly color my mesh based on the selected color.
Thank you