parseRRGGBB static method

ColorParser parseRRGGBB(
  1. String colorCode
)

Implementation

static ColorParser parseRRGGBB(String colorCode) {
  int rrggbb = int.parse(colorCode, radix: 16);
  int red = (rrggbb >> 16) & 0xFF;    // 前8位为Red通道
  int green = (rrggbb >> 8) & 0xFF;  // 接下来8位为Green通道
  int blue = rrggbb & 0xFF;          // 最后8位为Blue通道
  return ColorParser.argb(255, red, green, blue); // 默认Alpha通道为255(不透明)
}