colorFor method

UvColor colorFor(
  1. double value
)

Returns the color for a normalized value in 0..1.

Implementation

UvColor colorFor(double value) {
  if (colors.isEmpty) return const UvBasic16(7);
  final idx = (value.clamp(0, 1) * (colors.length - 1)).round();
  return colors[idx.clamp(0, colors.length - 1)];
}