Color class abstract

An abstract class representing a color in various color spaces.

This class provides a base for different color space implementations, such as RGB, HSL, and more. Colors can be used to represent and manipulate colors in different color models and can be used for various purposes, including UI design, graphics, and data visualization.

Implementers

Constructors

Color.new([num opacity = 1])

Properties

hashCode int
The hash code for this object.
no setterinherited
opacity num
This color’s opacity, typically in the range [0, 1].
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

brighter([num k]) Color
Returns a brighter copy of this color.
copy() Color
Returns a copy of this color.
darker([num k]) Color
Returns a darker copy of this color.
displayable() bool
Returns true if and only if the color is displayable on standard hardware.
formatHex() String
Returns a hexadecimal string representing this color in RGB space, such as #f7eaba.
formatHex8() String
Returns a hexadecimal string representing this color in RGBA space, such as #f7eaba90.
formatHsl() String
Returns a string representing this color according to the CSS Color Module Level 3 specification, such as hsl(257, 50%, 80%) or hsla(257, 50%, 80%, 0.2).
formatRgb() String
Returns a string representing this color according to the CSS Object Model specification, such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rgb() Rgb
Returns the RGB equivalent of this color.
toString() String
An alias for formatRgb.
override

Operators

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

Static Methods

parse(String specifier) Color
Parses the specified CSS Color Module Level 3 specifier string, returning an RGB or HSL color, along with CSS Color Module Level 4 hex specifier strings.
tryParse(String specifier) Color?
Like parse, except that this function returns null for invalid inputs instead of throwing.