Colour class

An immutable 32 bit color value in any format (normal, hex, rgb, argb, rgbo).

Here are some ways it could be constructed:

Colour c = const Colour(0xFF42A5F5);
Colour c = const Colour(0xFF42A5F5, 0.5);
Colour c = const Colour('42A5F5');
Colour c = const Colour('42A5F5', 0.5);
Colour c = const Colour('#42A5F5');
Colour c = const Colour('42a5f5');
Colour c = const Colour('#42a5f5', 0.8);
Colour c = const Colour(255, 255, 255); // RGB
Colour c = const Colour(255, 255, 255, 255); // ARGB
Colour c = const Colour(255, 255, 255, 0.5); // RGBO
Inheritance

Constructors

Colour(dynamic color, [dynamic x, dynamic y, dynamic z])

Properties

alpha int
The alpha channel of this color in an 8 bit value.
no setterinherited
blue int
The blue channel of this color in an 8 bit value.
no setterinherited
green int
The green channel of this color in an 8 bit value.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
opacity double
The alpha channel of this color as a double.
no setterinherited
red int
The red channel of this color in an 8 bit value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value int
A 32 bit value representing this color.
finalinherited

Methods

computeLuminance() double
Returns a brightness value between 0 for darkest and 1 for lightest.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
withAlpha(int a) Color
Returns a new color that matches this color with the alpha channel replaced with a (which ranges from 0 to 255).
inherited
withBlue(int b) Color
Returns a new color that matches this color with the blue channel replaced with b (which ranges from 0 to 255).
inherited
withGreen(int g) Color
Returns a new color that matches this color with the green channel replaced with g (which ranges from 0 to 255).
inherited
withOpacity(double opacity) Color
Returns a new color that matches this color with the alpha channel replaced with the given opacity (which ranges from 0.0 to 1.0).
inherited
withRed(int r) Color
Returns a new color that matches this color with the red channel replaced with r (which ranges from 0 to 255).
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getColor(dynamic color, [dynamic x, dynamic y, dynamic z]) int
get an immutable 32 bit color value from dynamic parameters
getColorFromHex(String color) int
parsing hex color for any of the four formats, such as: getColorFromHex('#FF121212') getColorFromHex('FF121212') getColorFromHex('#121212') getColorFromHex('121212')