How to change the color of a layer on the fly using color picker?

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

I am trying to change the color of a layer on the fly similar to ArcMAP Table of Content.

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

window.cesiumViewer.dataSources[((window.shape_details[contextid]))]

So, here window.shape_details is an object which contains all the layer information and contextid is HTML name of the layer in UI which is referencing the actual layers.

window.cesiumViewer.dataSources.get(currentDataSourceIndex).fill = Cesium.Color.fromCssColorString(selectedColor);

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

We want to change the color of the layers on the fly in the table of contents.

4. The Cesium version you're using, your operating system and browser.
Cesium 1.55
Windows 10
Chrome

I’m assuming you mean satellite imagery layer. If so, there are a couple of ways you can manipulate the color, this code example shows adjusting the hue, saturation, brightness etc.

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Imagery%20Adjustment.html

If you mean different type of data, can you tell me what data you’re loading in?