operator [] method

Color operator [](
  1. int index
)

Returns a primary color.

Implementation

Color operator [](int index) {
  switch (brightness) {
    case Brightness.light:
      switch (index) {
        case 30:
          return w30;
        case 40:
          return w40;
        case 50:
          return w50;
        case 60:
          return w60;
        case 70:
          return w70;
        default:
          throw Exception('Wrong index for primary color');
      }
    case Brightness.dark:
    default:
      switch (index) {
        case 30:
          return b30;
        case 40:
          return b40;
        case 50:
          return b50;
        case 60:
          return b60;
        case 70:
          return b70;
        default:
          throw Exception('Wrong index for primary color');
      }
  }
}