Error with calling function FromHexString

Here correctly work
scene.clearColor = new BABYLON.Color3.FromHexString('#FF377B');

but when I try do same in the my typescript code IDE and compiler are throw error TS2350: Only a void function can be called with the 'new' keyword.

my package.json

  "devDependencies": {
    "ts-loader": "6.0.4",
    "typescript": "3.5.3"
  "dependencies": {
    "babylonjs": "^4.0.3",
    "babylonjs-loaders": "^4.0.3",

FromHexString is a static function. Just remove the new before BABYLON.Color3 and it will be fine

1 Like

Yep, I found trouble — clearColor can be only Color4, so I did like this

const rgb = BABYLON.Color3.FromHexString(color);
this.scene.clearColor = new BABYLON.Color4(rgb.r, rgb.g, rgb.b, 1);