toHexString method

String toHexString([
  1. String template = '%r%g%b'
])

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());