Rgb class

A color representation in the RGB color space.

The Rgb class extends the Color class and represents a color in the RGB (Red, Green, Blue) color space.

Inheritance

Constructors

Rgb(num r, num g, num b, [num opacity = 1])
Constructs a new RGB color.
Rgb.from(Object? source)
Creates an instance of Rgb color by converting the specified source object.
factory

Properties

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

Methods

brighter([num k = 1]) Rgb
Returns a brighter copy of this color.
override
clamp() Rgb
Returns a new RGB color where the r, g, and b channels are clamped to the range [0, 255] and rounded to the nearest integer value, and the opacity is clamped to the range [0, 1].
copy({num? opacity}) Rgb
Returns a copy of this color.
override
copyWith({num? r, num? g, num? b, num? opacity}) Rgb
Creates a new Rgb color instance by copying the current instance and optionally updating its properties.
darker([num k = 1]) Rgb
Returns a darker copy of this color.
override
displayable() bool
Returns true if and only if the color is displayable on standard hardware.
override
formatHex() String
Returns a hexadecimal string representing this color in RGB space, such as #f7eaba.
override
formatHex8() String
Returns a hexadecimal string representing this color in RGBA space, such as #f7eaba90.
override
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).
inherited
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).
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rgb() Rgb
Returns the RGB equivalent of this color.
override
toString() String
An alias for formatRgb.
inherited

Operators

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