//Shadow palette for coloring the roofs //color pallet white->black var colorPalette = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525']; const shadowPalette = colorPalette.reverse(); //returns the responding color from the shadowPalette, depending on the inputShadowValue(0 to 1 in float) function getShadowPalette(inputShadowValue) { //checking for the float values var index = Math.ceil((shadowPalette.length - 1) * inputShadowValue); //console.log(inputShadowValue,"---",shadowPalette[index]); return shadowPalette[index]; }