rgbFromKeyword static method

List<num> rgbFromKeyword(
  1. String keyword
)

Lookup colorname keyword in colorKeywords map and return BLACK if the color is not found. Returns color as a num array of [red,green,blue].

Implementation

static List<num> rgbFromKeyword(String keyword) {
  keyword = keyword.toLowerCase().replaceAll(' ', '');
  var rgb = colorKeywords.containsKey(keyword)
      ? colorKeywords[keyword]!
      : colorKeywords['black']!;
  return [(rgb >> 16) & 0xff, (rgb >> 8) & 0xff, rgb & 0xff];
}