getColorAtValue static method
Implementation
static Color getColorAtValue(
List<Color> colors, List<double> stops, double value) {
for (int i = 0; i < stops.length - 1; i++) {
if (value <= stops[i + 1]) {
// Interpolate between the two colors
return Color.lerp(colors[i], colors[i + 1],
(value - stops[i]) / (stops[i + 1] - stops[i]))!;
}
}
return colors.last;
}