RayOklch class base

Oklch color space implementation with intuitive lightness, chroma, and hue controls.

Cylindrical form of Oklab: L (lightness 0-1), C (chroma/saturation), H (hue 0-360°).

Inheritance
Available extensions

Constructors

RayOklch.empty()
Creates a transparent black Oklch color.
const
RayOklch.fromComponents(double _l, double _c, double _h, [double _opacity = 1.0])
Creates a constant Oklch color from individual LCHO components.
const
RayOklch.fromComponentsValidated(double l, double c, double h, [double opacity = 1.0])
Creates a gamut clipped RayOklch from individual LCHO component values.
factory
RayOklch.fromJson(Map<String, dynamic> json)
Creates an Oklch color from a JSON value.
factory
RayOklch.fromList(List<num> values)
Creates a RayOklch from a list of component values.
factory
RayOklch.fromListValidated(List<num> values)
Creates a gamut clipped RayOklch from a list of component values.
factory
RayOklch.fromOklab(RayOklab oklab)
Creates an Oklch color from an Oklab color.
factory

Properties

chroma double
The chroma component (saturation, 0.0 to approximately 0.4).
no setter
colorSpace ColorSpace
The color space used by this Ray implementation.
no setteroverride
hashCode int
The hash code for this object.
no setteroverride
hue double
The hue component in degrees (0.0 to 360.0).
no setter
inverse RayOklch
Returns the color with inverted color values, preserving opacity.
no setteroverride
lightness double
The lightness component (0.0 to 1.0).
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
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

lerp(Ray other, double t) RayOklch
Linearly interpolates between this color and other.
override
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
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.
override
toJson() Map<String, dynamic>
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.
override
toRgb16() RayRgb16
Converts this color to 16-bit RGB representation.
override
toRgb8() RayRgb8
Converts this color to 8-bit RGB representation.
inherited
toString() String
A string representation of this object.
override
withChroma(double chroma) RayOklch
Creates a new color with different chroma (clamped to valid gamut range).
withHue(double hue) RayOklch
Creates a new color with different hue (normalized to 0-360°).
withLightness(double lightness) RayOklch
Creates a new color with different lightness (0.0-1.0), adjusting chroma to stay in gamut.
withOpacity(double opacity) RayOklch
Creates a new color with different opacity (0.0-1.0).
override

Operators

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

Static Methods

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