getBlockColor method

Color getBlockColor(
  1. int barIndex,
  2. int blockIndex,
  3. int maxBlocks
)

Implementation

Color getBlockColor(int barIndex, int blockIndex, int maxBlocks) {
  final hue = (barIndex / dataLength) * 360;
  const lightnessRange = 0.1;
  final lightness = 0.6 +
      (blockIndex / maxBlocks * lightnessRange).clamp(0.0, lightnessRange);
  return HSLColor.fromAHSL(1, hue, 0.8, lightness).toColor();
}