Below is the JavaScript code I am using to change the color of a part in a 3D model:
document.getElementById("custom_color").onchange = function() {
var custom_color = $("#custom_color").val().split('#').join("0x");
console.log(custom_color);
const color = new THREE.MeshPhongMaterial({ color: custom_color, shininess: 10 });
console.log(color);
var name = $(".--is-active").data("option");
initColor(speaker,name,color);
}
The first console.log(custom_color) produces this result:
0xd04343
The second console.log(color) shows the color object as:
color object as
b: 1
g: 1
r: 1
I am puzzled as to why THREE.MeshPhongMaterial is not converting it properly.