onHex method Null safety

Chalk onHex(
  1. dynamic hex
)

Returns a Chalk with the background color set to the passed in RGB Hex code. This dynamically accepts color hex codes as integer codes (0xAABBCC) or (0xABC) or as strings ('#AABBCC') or ('#ABC')

Implementation

Chalk onHex(dynamic hex) {
  var rgb = ColorUtils.hex2rgb(hex);
  return makeRGBChalk(rgb[0], rgb[1], rgb[2], bg: true);
}