Yes, you can set it through the viewer.setThemingColor() function. The parameter it accepts is a THREE.Vector4. Forge Viewer uses (x, y, z) of THREE.Vector4 to represent the three primary colors (r, g, b), w represents the opacity alpha, note that each parameter is between 0 Between 1 and 1, the color codes of the three primary colors must be divided by 255. The calling example is as follows:
// 变成红色
var color = new THREE.Vector4( 255/255, 0, 0, 1 );
viewer.setThemingColor( 2498, color);
Screenshot of the result, the original green space turned red:
If you want to restore the color of the component, you can call viewer.clearThemingColors() This function will clear the color settings. The results are as follows:
Yes, you can set it through the
viewer.setThemingColor()
function. The parameter it accepts is aTHREE.Vector4
. Forge Viewer uses(x, y, z)
ofTHREE.Vector4
to represent the three primary colors(r, g, b)
,w
represents the opacityalpha
, note that each parameter is between 0 Between 1 and 1, the color codes of the three primary colors must be divided by 255. The calling example is as follows:Screenshot of the result, the original green space turned red:
If you want to restore the color of the component, you can call
viewer.clearThemingColors()
This function will clear the color settings. The results are as follows: