ColorUtils class

Helper class for color operations.

Constructors

ColorUtils()

Properties

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

Methods

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

Operators

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

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. [...]

Constants

BASIC_COLOR_BLUE → const String
"blue"
BASIC_COLOR_GREEN → const String
"green"
BASIC_COLOR_RED → const String
"red"
HEX_BLACK → const String
"#000000"
HEX_WHITE → const String
"#FFFFFF"