ColorUtils class

Helper class for color operations.




hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
toString() → String
Returns a string representation of this object.


operator ==(dynamic other) → bool
The equality operator.

Static Methods

basicColorsFromHex(String hex) → Map<String, int>
Fetches the basic color int values for red, green, blue from the given hex string. [...]
calculateRelativeLuminance(int red, { int green, { int blue, { int decimals: 2 }) → double
Calculates the relative luminance for the given red, green, blue values. [...]
contrastColor(String hex) → String
Calculates the limunance for the given hex color and returns black as hex for bright colors, white as hex for dark colors.
fillUpHex(String hex) → String
Fills up the given 3 char hex string to 6 char hex string. [...]
hexToInt(String hex) → int
Converts the given hex color string to the corresponding int
intToHex(int i) → String
Converts the given integer i to a hex string with a leading #.
isDark(String hex) → bool
Returns true or false if the calculated relative luminance from the given hex is less than 0.5.
shadeColor(String hex, double percent) → String
Lightens or darkens the given hex color by the given percent. [...]
swatchColor(String hex, { double percentage: 15, int amount: 5 }) → List<String>
Swatch the given hex color. [...]


BASIC_COLOR_BLUE → const String
BASIC_COLOR_GREEN → const String
BASIC_COLOR_RED → const String
HEX_BLACK → const String
HEX_WHITE → const String