Color class

Represents a 24-bit RGB color with 8-bit alpha, packed into a single 32-bit integer. Using a single final int field minimizes memory footprint for each Color instance.

Constructors

Color(int r, int g, int b)
Creates an opaque color from red, green, and blue components.
const
Color.argb(int argb)
Creates a color with custom alpha.
const

Properties

a int
Extract the alpha channel (0-255).
no setter
argb int
The 32-bit integer representation of the color in ARGB format.
final
b int
Extract the blue channel (0-255).
no setter
backgroundCode String
Returns the ANSI escape sequence for setting this color as background.
no setter
foregroundCode String
Returns the ANSI escape sequence for setting this color as foreground.
no setter
g int
Extract the green channel (0-255).
no setter
hashCode int
The hash code for this object.
no setteroverride
isTransparent bool
Returns true if this color is fully transparent (alpha == 0).
no setter
r int
Extract the red channel (0-255).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

background(String text) String
Creates a string that applies this color as a background color to text.
foreground(String text) String
Creates a string that applies this color as a foreground color to text.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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