RayRgb8 class base

8-bit RGB color implementation with support for multiple input/output formats.

Stored internally as ARGB integer for Flutter compatibility and performance. Each color channel uses 8 bits (0-255 range).

Inheritance
Available extensions

Constructors

RayRgb8.empty()
Creates a transparent black color.
const
RayRgb8.fromArgbInt(int value)
Creates a RayRgb8 from a 32-bit ARGB integer value.
const
RayRgb8.fromComponents(num red, num green, num blue, [num alpha = 255])
Creates a RayRgb8 from individual RGBA component values (0-255).
factory
RayRgb8.fromComponentsNative(int red, int green, int blue, [int alpha = 255])
Creates a RayRgb8 from individual RGBA component values (0-255) with native precision.
const
RayRgb8.fromComponentsNormalized(num red, num green, num blue, [num alpha = 1.0])
Creates a RayRgb8 from normalized component values (0.0-1.0).
factory
RayRgb8.fromHex(String value, {HexFormat format = HexFormat.rgba})
Creates a RayRgb8 from a hexadecimal color string.
factory
RayRgb8.fromJson(int json)
Creates a RayRgb8 for JSON deserialization.
factory
RayRgb8.fromList(List<num> values)
Creates a RayRgb8 from a list of component values.
factory
RayRgb8.fromListNative(List<int> values)
Creates a RayRgb8 from a list of native component values (0-255).
RayRgb8.fromRgb16(dynamic rgb16Color)
Creates a RayRgb8 from a 16-bit RGB color, downscaling to 8-bit.
factory
RayRgb8.fromRgbaInt(int value)
Creates a RayRgb8 from a 32-bit RGBA integer value.
const

Properties

alpha num
The alpha channel of this color as a normalized 8-bit value (0-255).
no setteroverride
alphaNative int
The alpha channel of this color in native 8-bit value (0-255).
no setteroverride
alphaNormalized double
The alpha channel as a normalized value (0.0-1.0).
no setterinherited
blue num
The blue channel of this color as a normalized 8-bit value (0-255).
no setteroverride
blueNative int
The blue channel of this color in native 8-bit value (0-255).
no setteroverride
blueNormalized double
The blue channel as a normalized value (0.0-1.0).
no setterinherited
colorSpace ColorSpace
The color space used by this Ray implementation.
no setteroverride
green num
The green channel of this color as a normalized 8-bit value (0-255).
no setteroverride
greenNative int
The green channel of this color in native 8-bit value (0-255).
no setteroverride
greenNormalized double
The green channel as a normalized value (0.0-1.0).
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
inverse RayRgb8
Returns the color with inverted color values, preserving opacity.
no setteroverride
inversePrecise → (double, double, double, double)
Shared inverse calculation helper that preserves fractional precision. Returns inverted RGBA values as doubles to preserve precision.
no setterinherited
luminance double
Returns the relative luminance of the color (0.0 = darkest, 1.0 = lightest).
no setterinherited
opacity double
The opacity of this color (0.0 = transparent, 1.0 = opaque).
no setterinherited
red num
The red channel of this color as a normalized 8-bit value (0-255).
no setteroverride
redNative int
The red channel of this color in native 8-bit value (0-255).
no setteroverride
redNormalized double
The red channel as a normalized value (0.0-1.0).
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

computeLuminance() double
Computes the relative luminance using WCAG 2.0 specification (0.0-1.0). Where R, G, B are the linearized color components.
inherited
lerp(Ray other, double t) RayRgb8
Linearly interpolates between this color and other.
override
lerpPrecise(Ray other, double t) → (double, double, double, double)
Shared lerp calculation helper that preserves fractional precision. Returns interpolated RGBA values as doubles to preserve precision.
inherited
maxContrast(Ray a, Ray b) Ray
Returns the color (a or b) with the highest contrast to this color.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toArgbInt() int
Returns the color as a 32-bit ARGB integer.
toColor() Color

Available on Ray, provided by the RayToFlutterColor extension

Converts this RayRgb8 to a Flutter Color.
toColorSpace<T extends Ray>() → T
Converts this color to a different color space.
inherited
toColorWithOpacity(double opacity) Color

Available on Ray, provided by the RayToFlutterColor extension

Converts this Ray to a Flutter Color with specific opacity.
toHex([int? length, HexFormat format = HexFormat.rgba]) String
Converts the color to an sRGB hexadecimal string (6 or 8 characters).
toHsl() RayHsl
Converts this color to HSL representation.
override
toJson() int
Returns the color as a JSON-serializable value.
override
toList() List<num>
Returns the color components as a list.
override
toOklab() RayOklab
Converts this color to Oklab representation.
override
toOklch() RayOklch
Converts this color to Oklch representation.
inherited
toRgb16() RayRgb16
Optimized bit-depth conversion methods
override
toRgb8() RayRgb8
Converts this color to 8-bit RGB representation.
override
toRgbaInt() int
Returns the color as a 32-bit RGBA integer (alpha last).
toRgbaStr() String
Converts the color to a CSS rgba() string.
inherited
toRgbInt() int
Returns the color as a 24-bit RGB integer, discarding alpha.
toRgbStr() String
Converts the color to a CSS rgb() string.
inherited
toString() String
A string representation of this object.
override
withAlpha(double alpha) RayRgb8
Creates a new RayRgb8 with the same RGB values but a different alpha.
override
withAlphaNative(int alpha) RayRgb8
Creates a new RayRgb8 with a different alpha using native precision.
override
withBlue(double blue) RayRgb8
Creates a new RayRgb8 with a different blue component.
override
withBlueNative(int blue) RayRgb8
Creates a new RayRgb8 with a different blue component using native precision.
override
withGreen(double green) RayRgb8
Creates a new RayRgb8 with a different green component.
override
withGreenNative(int green) RayRgb8
Creates a new RayRgb8 with a different green component using native precision.
override
withOpacity(double opacity) RayRgb8
Creates a new color with different opacity (0.0-1.0).
inherited
withRed(double red) RayRgb8
Creates a new RayRgb8 with a different red component.
override
withRedNative(int red) RayRgb8
Creates a new RayRgb8 with a different red component using native precision.
override

Operators

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

Static Methods

parse(String value) RayRgb8
Parses a color string and returns a RayRgb8.
override