Set Ellipsoid color based on hex code from database

Hi Guys,

How can we set Ellipsoid color from the Hexcode stored in the Database ?

Thanks,
Kulvinder Singh

You can change the base color of the globe like this: https://cesium.com/docs/cesiumjs-ref-doc/Globe.html?classFilter=Globe#baseColor

This is the color that appears when no satellite imagery is present. To set a color from a hex code use Color.fromCssColorString: https://cesium.com/docs/cesiumjs-ref-doc/Color.html#.fromCssColorString

Thanks Omar, I will try to use this in my App.

One more thing: Is there a way in Cesium to apply Legends (Custom legends)?

Thanks,
Kulvinder Singh

If you’re using Cesium Stories a legend is automatically generated for you: https://cesium.com/docs/tutorials/stories-styling/.

Otherwise you can do the same thing in your app by creating an HTML element on top of the canvas with the info you need.

Thanks Omar, yes I did the same.

I just need to fix the colour of poly line based on the hex code value from database. Can you guide me through using which approach I can achieve this ? If any default functionality is available in Cesium?

Also can you please take a look at my other thread to control the Cesium rotation please?

Much thanks
Kulvinder Singh

The examples I linked to above should do what you need: https://cesium.com/docs/cesiumjs-ref-doc/Color.html#.fromCssColorString

var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF');

This is a hex value for a blue color. Assuming you already have a way to retrieve this from the database, you can pass it to this CesiumJS function.

Hi Omar,

I appreciate.

I was able to fix this few days ago.
Much thanks for responding.
Kulvinder Singh