I can't apply color on Material

1. A concise explanation of the problem you’re experiencing.

I try to change the default color of my material and I have an error :

It’s the first time I use Cesium, so I think the problem is in my code.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

You can find my code and the error here :

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=fZLRa9swEMb/FeGXOmDktOleOjcspGUrpHRQaBnTHq72JRGVJXM6O2Qj/3vlJF6cZMz2g+6+7zt0P9wAiUbjCkncCosrMUWv61K+bHvxRb4tp84yaIt0MfisbBMy2noGm+Nx6iu6EpnWD3s1/qOs4vZd7BVx0/e/gjFdpvWKk6dyXrN21ofYPjIF4nACO5JzcuUdLgjRT4hg/Q31Ysk+/nk+6PoqEeG7HA6HyT/U0X/V60SMduqvQbfPZrBpUQQYW1DS52hRVqTLcOEGvYSiiHubfu+UcyQdrHbJDmvSmaCqEGhL+ojcIzCSBjP5qx8GKy736o3oNRXXVs8dlf6krTh3xtEBcVvJH/ez2dOrXGleTky1hHgoPw36sc2h2Ig+lx2YKIkyz2uD4x3SL7qsHLGoycRSpoxlZcI1ffpW5+/IMve+DWZpF8oK3Qhd3Kro5CdUkcgNeB+UeW3Ms/6NKhpnafAfxYyDQtvFU4NkYN1alpfj2a4ppczSUJ6n2DnzBtSb+AE

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I simply want to change color.

4. The Cesium version you’re using, your operating system and browser.

I use cesium in Angular so :

“angular-core”: “6.1.6”

“angular-cesium”: “0.0.53”

Have you an idea ?

Thanks !

Please rather take this version of the code :

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=lVNdS8MwFP0roS9rYaSbCuqswzFBBUVB0QfrQ2zvtmCalJu0UqX/3aRb574UvYGQ5Jxz057TlgxJyeEdkJwSCe9kDJoXGX1szvxO0mzHShrGJWAnOIllaTVcasNkAuuqC1AZGKyuFqj/GcvYuDFdIGSwyn9iQrQaxyUblSvNDVdSW9lCMmZo7IrJfTpBlZ3DFAH0CJFVl8CnM6P95+1G/WPa65KDQzf3e7bs4kfW0e+svd4/WH+7cZX1ErSe1UHt7LaGN2FQnYAEmiPPrCklaMrS1F9x865Ftm1vA3FGttF1WxLLc2DYpLmWzg0zgJyJ0RLflVG2YA3I8lY3TJXDYLNTE9mDRfzOWAllP6cdnrgqJJ8ozHTTlPxQiWux9sRNU79xvu+mdhXsblJvH9ff5i/BOpjH4HW9SJtKwHAOnfEsV2hIgcKnNDSQ5cK+qA5fi+QNDE20dsIobEVRykvC09PY2/itYo8kgmltkUkhxD3/gNgbRqHlr8mEYimX09sSULDKUWb94fX8kFIahXa7rTJKiVeGKx2/AA

I think you have the wrong syntax for your material creation. It should be:

viewer.scene.primitives.add(new Cesium.Primitive({

geometryInstances : instance,

appearance : new Cesium.MaterialAppearance({

material: new Cesium.Material({

fabric : {

type : ‘Color’,

uniforms : {

color : new Cesium.Color(1.0, 1.0, 0.0, 1.0)

}

}

})

})

}));

``

Which I figured out from looking at this page in the docs:

https://cesiumjs.org/Cesium/Build/Documentation/Material.html

You might also find this guide helpful: https://cesium.com/docs/tutorials/geometry-and-appearances/