addColorKeywordRgb method Null safety

void addColorKeywordRgb(
  1. String colorname,
  2. int red,
  3. int green,
  4. int blue
)

Add RGB color to the colorKeywords[] map that is used for dynamic lookup of colors by name.

Implementation

static void addColorKeywordRgb(
    String colorname, int red, int green, int blue) {
  int colorInt = 0xff000000 |
      ((red & 0xff) << 16) |
      ((green & 0xff) << 8) |
      (blue & 0xff);
  colorKeywords[colorname.toLowerCase().replaceAll(' ', '')] = colorInt;
}