operator [] method

Color operator [](
  1. int index
)

Returns a background color.

Implementation

Color operator [](int index) {
  switch (brightness) {
    case Brightness.light:
      switch (index) {
        case 0:
          return w0;
        case 4:
          return w4;
        case 8:
          return w8;
        case 12:
          return w12;
        case 16:
          return w16;
        case 20:
          return w20;
        default:
          throw Exception('Wrong index for backgrount color');
      }
    case Brightness.dark:
    default:
      switch (index) {
        case 0:
          return b0;
        case 4:
          return b4;
        case 8:
          return b8;
        case 12:
          return b12;
        case 16:
          return b16;
        case 20:
          return b20;
        default:
          throw Exception('Wrong index for backgrount color');
      }
  }
}