CandiColor class
A Color implementation that retains OKLCH metadata.
OKLCH is a perceptually uniform color space that provides better color manipulation and contrast calculations than traditional RGB.
Properties
- lightness: Perceived lightness (0.0 = black, 1.0 = white)
- chroma: Color intensity (0.0 = gray, higher = more saturated)
- hue: Color angle in degrees (0-360)
- candiOpacity: Alpha channel (0.0 = transparent, 1.0 = opaque)
Example
final accent = CandiColors.light.accent;
print(accent.lightness); // 0.52
print(accent.chroma); // 0.06
print(accent.hue); // 230.0
Constructors
- CandiColor(int value, {required double lightness, required double chroma, required double hue, double candiOpacity = 1.0})
-
Creates a CandiColor with OKLCH metadata.
const
Properties
- a → double
-
The alpha channel of this color.
finalinherited
- alpha → int
-
The alpha channel of this color in an 8 bit value.
no setterinherited
- b → double
-
The blue channel of this color.
finalinherited
- blue → int
-
The blue channel of this color in an 8 bit value.
no setterinherited
- candiOpacity → double
-
Opacity/alpha value (0.0-1.0).
final
- chroma → double
-
Color intensity/saturation in OKLCH.
final
- colorSpace → ColorSpace
-
The color space of this color.
finalinherited
- g → double
-
The green channel of this color.
finalinherited
- green → int
-
The green channel of this color in an 8 bit value.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hue → double
-
Hue angle in degrees (0-360).
final
- lightness → double
-
Perceived lightness in OKLCH (0.0-1.0).
final
- opacity → double
-
The alpha channel of this color as a double.
no setterinherited
- r → double
-
The red channel of this color.
finalinherited
- red → int
-
The red channel of this color in an 8 bit value.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → int
-
A 32 bit value representing this color.
no setterinherited
Methods
-
computeLuminance(
) → double -
Returns a brightness value between 0 for darkest and 1 for lightest.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toARGB32(
) → int -
Returns a 32-bit value representing this color.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
withAlpha(
int a) → Color -
Returns a new color that matches this color with the alpha channel
replaced with
a(which ranges from 0 to 255).inherited -
withBlue(
int b) → Color -
Returns a new color that matches this color with the blue channel replaced
with
b(which ranges from 0 to 255).inherited -
withGreen(
int g) → Color -
Returns a new color that matches this color with the green channel
replaced with
g(which ranges from 0 to 255).inherited -
withOpacity(
double opacity) → Color -
Returns a new color that matches this color with the alpha channel
replaced with the given
opacity(which ranges from 0.0 to 1.0).inherited -
withRed(
int r) → Color -
Returns a new color that matches this color with the red channel replaced
with
r(which ranges from 0 to 255).inherited -
withValues(
{double? alpha, double? red, double? green, double? blue, ColorSpace? colorSpace}) → Color -
Returns a new color with the provided components updated.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited