alternatingColorForIndex function

Color alternatingColorForIndex(
  1. int index,
  2. ColorScheme colorScheme
)

Gets an alternating color to use for indexed UI elements.

Implementation

Color alternatingColorForIndex(int index, ColorScheme colorScheme) {
  return index % 2 == 1
      ? colorScheme.alternatingBackgroundColor1
      : colorScheme.alternatingBackgroundColor2;
}