Color class abstract

A CSS color value.

See also Colors for a list of predefined color names.

Read more: MDN Color

Constructors

Color(String value)
Constructs a Color from a css color value.
const
factory
Color.hsl(int hue, int saturation, int lightness)
Constructs a Color from hue, saturation and lightness values
const
factory
Color.hsla(int hue, int saturation, int lightness, double alpha)
Constructs a Color from hue, saturation, lightness and alpha values
const
factory
Color.rgb(int red, int green, int blue)
Constructs a Color from red, green and blue values
const
factory
Color.rgba(int red, int green, int blue, double alpha)
Constructs a Color from red, green, blue and alpha values
const
factory
Color.value(int value)
Constructs a Color from an integer value.
const
factory
Color.variable(String value)
Constructs a variable containing color.
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value String
The color css value
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
withHue(double hue, {bool replace = true}) Color
Returns a new color that matches this color, but with its hue modified.
withLightness(double lightness, {bool replace = true}) Color
Returns a new color that matches this color, but with its lightness modified.
withOpacity(double opacity, {bool replace = true}) Color
Returns a new color that matches this color, but with its opacity modified.
withValues({double? red, double? green, double? blue, double? alpha}) Color
Returns a new color with the provided values replaced.

Operators

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

Constants

currentColor → const Color
The currentcolor keyword represents the value of an element's color property. This lets you use the color value on properties that do not receive it by default.
inherit → const Color
initial → const Color
revert → const Color
revertLayer → const Color
unset → const Color