basicColorsFromHex static method
Fetches the basic color int values for red, green, blue from the given hex
string.
The values are returned inside a map with the following keys :
- red
- green
- blue
Implementation
static Map<String, int> basicColorsFromHex(String hex) {
hex = fillUpHex(hex);
if (!hex.startsWith('#')) {
hex = '#' + hex;
}
var R = int.parse(hex.substring(1, 3), radix: 16);
var G = int.parse(hex.substring(3, 5), radix: 16);
var B = int.parse(hex.substring(5, 7), radix: 16);
return {BASIC_COLOR_RED: R, BASIC_COLOR_GREEN: G, BASIC_COLOR_BLUE: B};
}