toHex method

String toHex({
  1. bool leadingHashSign = true,
})

Prefixes a hash sign if leadingHashSign is set to true (default is true).

Implementation

String toHex({bool leadingHashSign = true}) =>
    '${leadingHashSign ? '#' : ''}'
    '${a.toInt().toRadixString(16).padLeft(2, '0')}'
    '${r.toInt().toRadixString(16).padLeft(2, '0')}'
    '${g.toInt().toRadixString(16).padLeft(2, '0')}'
    '${b.toInt().toRadixString(16).padLeft(2, '0')}';