Last active
September 24, 2019 02:53
-
-
Save sudeshim3/7137e84a78d1f28e32d7849020b6b05a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HexColor extends Color { | |
static int _getColorFromHex(String hexColor) { | |
hexColor = hexColor.toUpperCase().replaceAll("#", ""); | |
if (hexColor.length == 6) { | |
hexColor = "FF" + hexColor; | |
} | |
return int.parse(hexColor, radix: 16); | |
} | |
HexColor(final String hexColor) : super(_getColorFromHex(hexColor)); | |
} | |
//Link for formula to convert hex to normal hex color | |
//https://stackoverflow.com/questions/15852122/hex-transparency-in-colors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment