Abstract base class for RGB color implementations with shared operations.
Provides common functionality for RGB colors regardless of bit depth. Subclasses implement storage-specific optimizations while sharing algorithms.
- Inheritance
- Available extensions
Constructors
- RayRgbBase()
-
const
Properties
- alpha → num
-
The alpha channel as a normalized 8-bit value (0-255).
no setter
- alphaNative → D
-
The alpha component as an integer in the subclass's native bit depth.
no setter
- alphaNormalized → double
-
The alpha channel as a normalized value (0.0-1.0).
no setter
- blue → num
-
The blue channel as a normalized 8-bit value (0-255).
no setter
- blueNative → D
-
The blue component as an integer in the subclass's native bit depth.
no setter
- blueNormalized → double
-
The blue channel as a normalized value (0.0-1.0).
no setter
- colorSpace → ColorSpace
-
The color space used by this Ray implementation.
no setterinherited
- green → num
-
The green channel as a normalized 8-bit value (0-255).
no setter
- greenNative → D
-
The green component as an integer in the subclass's native bit depth.
no setter
- greenNormalized → double
-
The green channel as a normalized value (0.0-1.0).
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- inverse → Ray
-
Returns the color with inverted color values, preserving opacity.
no setterinherited
- inversePrecise → (double, double, double, double)
-
Shared inverse calculation helper that preserves fractional precision.
Returns inverted RGBA values as doubles to preserve precision.
no setter
- luminance → double
-
Returns the relative luminance of the color (0.0 = darkest, 1.0 = lightest).
no setteroverride
- opacity → double
-
The opacity of this color (0.0 = transparent, 1.0 = opaque).
no setteroverride
- red → num
-
The red channel as a normalized 8-bit value (0-255).
no setter
- redNative → D
-
The red component as an integer in the subclass's native bit depth.
no setter
- redNormalized → double
-
The red channel as a normalized value (0.0-1.0).
no setter
- 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.
-
lerp(
Ray other, double t) → Ray -
Linearly interpolates between this color and
other.inherited -
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.
-
maxContrast(
Ray a, Ray b) → Ray -
Returns the color (
aorb) with the highest contrast to this color.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
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. -
toHsl(
) → RayHsl -
Converts this color to HSL representation.
inherited
-
toJson(
) → dynamic -
Returns the color as a JSON-serializable value.
inherited
-
toList(
) → List< num> -
Returns the color components as a list.
inherited
-
toOklab(
) → RayOklab -
Converts this color to Oklab representation.
inherited
-
toOklch(
) → RayOklch -
Converts this color to Oklch representation.
override
-
toRgb16(
) → RayRgb16 -
Converts this color to 16-bit RGB representation.
inherited
-
toRgb8(
) → RayRgb8 -
Converts this color to 8-bit RGB representation.
inherited
-
toRgbaStr(
) → String - Converts the color to a CSS rgba() string.
-
toRgbStr(
) → String - Converts the color to a CSS rgb() string.
-
toString(
) → String -
A string representation of this object.
inherited
-
withAlpha(
double alpha) → T -
withAlphaNative(
D alpha) → T -
withBlue(
double alpha) → T -
withBlueNative(
D alpha) → T -
withGreen(
double alpha) → T -
withGreenNative(
D alpha) → T -
withOpacity(
double opacity) → T -
Creates a new color with different opacity (0.0-1.0).
override
-
withRed(
double alpha) → T -
withRedNative(
D alpha) → T
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
linearizeColorComponent(
double component) → double - Linearizes a color component for RGB luminance calculation.