HspColor class
A color in the HSP color space.
The HSP color space contains channels for hue, saturation, and perceivedBrightness.
- Implemented types
- Available extensions
Constructors
- HspColor(num hue, num saturation, num perceivedBrightness, [int alpha = 255])
-
A color in the HSP color space.
const
-
HspColor.extrapolate(List<
double> values) -
Constructs a HspColor from a list of
hsp
values on a0
to1
scale.factory - HspColor.from(ColorModel color)
-
Constructs a HspColor from
color
.factory - HspColor.fromColor(Color color)
-
Constructs a HspColor from
color
.factory - HspColor.fromHex(String hex)
-
Constructs a HspColor from a RGB
hex
color.factory -
HspColor.fromList(List<
num> values) -
Constructs a HspColor from a list of
hsp
values.factory - HspColor.random({num minHue = 0, num maxHue = 360, num minSaturation = 0, num maxSaturation = 100, num minPerceivedBrightness = 0, num maxPerceivedBrightness = 100, int? seed})
-
Generates a HspColor at random.
factory
Properties
- alpha → int
-
The alpha value of this color.
finalinherited
- blue → int
-
The blue value of this color.
no setterinherited
- chroma → double
-
Calculates a value representing this color's lightness on a linear scale.
no setterinherited
- green → int
-
The green value of this color.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hex → String
-
Returns
this
as a hexidecimal string.no setterinherited - hue → num
-
The hue value of this color.
finalinherited
- inverted → HspColor
-
Adjusts this colors hue by
180
degrees while inverting the saturation and perceivedBrightness values.no setter - isBlack → bool
-
Returns
true
if this color is pure black.no setterinherited - isMonochromatic → bool
-
Returns
true
if this color is monochromatic.no setterinherited - isWhite → bool
-
Returns
true
if this color is pure white.no setterinherited - opacity → double
-
The
alpha
value as a double normalized to a0.0
to1.0
range.no setterinherited - opposite → HspColor
-
Returns the color with the hue opposite of this colors'.
no setter
- perceivedBrightness → num
-
Thie perceived brightness value of this color.
finalinherited
- red → int
-
The red value of this color.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- saturation → num
-
The saturation value of this color.
finalinherited
- value → int
-
A 32 bit value representing this color.
no setteroverride
Methods
-
castTo(
ColorModel other) → ColorModel -
Converts this color to
other
's color space.inherited -
computeLuminance(
) → double -
Returns a brightness value between 0 for darkest and 1 for lightest.
inherited
-
convert(
ColorModel other) → HspColor -
Converts
other
to this color's color space. -
cooler(
num amount, {bool relative = true}) → HspColor -
Adjusts the hue of this color by
amount
towards270
degrees, capping the value at270
. -
copyWith(
{num? hue, num? saturation, num? perceivedBrightness, int? alpha}) → HspColor - Returns a copy of this color modified with the provided values.
-
distanceTo(
ColorModel color) → double -
Returns the distance between
this
color's hue andcolor
's hue in degrees.inherited -
equals(
ColorModel color) → bool -
Compares colors in the RGB color space.
inherited
-
interpolate(
ColorModel end, double step) → HspColor -
Interpolates to
step
betweenthis
andend
. -
lerpTo(
ColorModel color, int steps, {ColorSpace? colorSpace, bool excludeOriginalColors = false}) → List< HspColor> -
Returns the interpolated
steps
between this color andcolor
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rotateHue(
num amount) → HspColor -
Rotates the hue of this color by
amount
in degrees. -
rotateHueRad(
double amount) → HspColor -
Rotates the hue of this color by
amount
in radians. -
toCmykColor(
) → CmykColor -
Converts
this
to the CMYK color space.inherited -
toFactoredList(
) → List< double> -
Returns a fixed-length list containing the
hue
,saturation
, andperceivedBrightness
values factored to be on 0 to 1 scale.inherited -
toFactoredListWithAlpha(
) → List< double> -
Returns a fixed-length list containing the
hue
,saturation
,perceivedBrightness
, andalpha
values factored to be on 0 to 1 scale.inherited -
toHsbColor(
) → HsbColor -
Converts
this
to the HSV color space.inherited -
toHsiColor(
) → HsiColor -
Converts
this
to the HSI color space.inherited -
toHslColor(
) → HslColor -
Converts
this
to the HSL color space.inherited -
toHspColor(
) → HspColor -
Converts
this
to the HSP color space. -
toLabColor(
) → LabColor -
Converts
this
to the LAB color space.inherited -
toList(
) → List< num> -
Returns a fixed-length list containing the
hue
,saturation
, andperceivedBrightness
values, in that order.inherited -
toListWithAlpha(
) → List< num> -
Returns a fixed-length list containing the
hue
,saturation
,perceivedBrightness
, andalpha
values, in that order.inherited -
toOklabColor(
) → OklabColor -
Converts
this
to the Oklab color space.inherited -
toRgbColor(
) → RgbColor -
Converts
this
to the RGB color space.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
toXyzColor(
) → XyzColor -
Converts
this
to the XYZ color space.inherited -
warmer(
num amount, {bool relative = true}) → HspColor -
Adjusts the hue of this color by
amount
towards90
degrees, capping the value at90
. -
withAlpha(
int alpha) → HspColor -
Returns this
HspColor
modified with the providedalpha
value. -
withBlue(
num blue) → HspColor -
Returns a new color that matches this color with the blue channel replaced
with
b
(which ranges from 0 to 255).override -
withChroma(
double chroma) → HspColor -
Converts this color to the Oklab color space, calculates and
applies a new lightness value from the proivded
chroma
value, and converts it back to the original color space. -
withGreen(
num green) → HspColor -
Returns a new color that matches this color with the green channel
replaced with
g
(which ranges from 0 to 255).override -
withHue(
num hue) → HspColor -
Returns this
HspColor
modified with the providedhue
value. -
withOpacity(
double opacity) → HspColor -
Returns this
ColorModel
with the providedopacity
value. -
withRed(
num red) → HspColor -
Returns a new color that matches this color with the red channel replaced
with
r
(which ranges from 0 to 255).override -
withValues(
List< num> values) → HspColor - Returns a color in this color's color space with the values provided.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited