toHexString method
Output color in hex format
Implementation
String toHexString([String template = '%r%g%b']) => template
.replaceAll(RegExp('%r'), tohex(red))
.replaceAll(RegExp('%R'), tohex(red).toUpperCase())
.replaceAll(RegExp('%g'), tohex(green))
.replaceAll(RegExp('%G'), tohex(green).toUpperCase())
.replaceAll(RegExp('%b'), tohex(blue))
.replaceAll(RegExp('%B'), tohex(blue).toUpperCase());