HsbColor class

A color in the hsb (HSB) color space.

The hsb color space contains channels for hue, saturation, and brightness.

Implemented types
Available extensions

Constructors

HsbColor.new(num hue, num saturation, num brightness, [int alpha = 255])
A color in the hsb (HSB) color space.
const
HsbColor.extrapolate(List<double> values)
Constructs a HsbColor from a list of hsb values on a 0 to 1 scale.
factory
HsbColor.from(ColorModel color)
Constructs a HsbColor from color.
factory
HsbColor.fromColor(Color color)
Constructs a HslColor from color.
factory
HsbColor.fromHex(String hex)
Constructs a HsbColor from a RGB hex color.
factory
HsbColor.fromList(List<num> values)
Constructs a HsbColor from a list of hsb values.
factory
HsbColor.random({num minHue = 0, num maxHue = 360, num minSaturation = 0, num maxSaturation = 100, num minBrightness = 0, num maxBrightness = 100, int? seed})
Generates a HsbColor at random.
factory

Properties

a double
The alpha channel of this color.
finalinherited
alpha int
The alpha value of this color.
finalinherited
b double
The blue channel of this color.
finalinherited
blue int
The blue value of this color.
no setterinherited
brightness num
The brightness value of this color.
finalinherited
chroma double
Calculates a value representing this color's lightness on a linear scale.
no setterinherited
colorSpace ColorSpace
The color space of this color.
finalinherited
g double
The green channel of this color.
finalinherited
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 HsbColor
Adjusts this colors hue by 180 degrees while inverting the saturation and brightness 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 a 0.0 to 1.0 range.
no setterinherited
opposite HsbColor
Returns the color with the hue opposite of this colors'.
no setter
r double
The red channel 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) HsbColor
Converts other to this color's color space.
cooler(num amount, {bool relative = true}) HsbColor
Adjusts the hue of this color by amount towards 270 degrees, capping the value at 270.
copyWith({num? hue, num? saturation, num? brightness, int? alpha}) HsbColor
Returns a copy of this color modified with the provided values.
distanceTo(ColorModel color) double
Returns the distance between this color's hue and color's hue in degrees.
inherited
equals(ColorModel color) bool
Compares colors in the RGB color space.
inherited
interpolate(Color end, double step) Color

Available on Color, provided by the LerpToColor extension

Interpolates to the defined step between this color and end.
interpolate(ColorModel end, double step) HsbColor
Interpolates to step between this and end.
lerpTo(ColorModel color, int steps, {ColorSpace? colorSpace, bool excludeOriginalColors = false}) List<HsbColor>
Returns the interpolated steps between this color and color.
lerpTo(Color color, int steps, {ColorSpace? colorSpace, bool excludeOriginalColors = false}) List<Color>

Available on Color, provided by the LerpToColor extension

Returns the interpolated steps between this color and color.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rotateHue(num amount) HsbColor
Rotates the hue of this color by amount in degrees.
rotateHueRad(double amount) HsbColor
Rotates the hue of this color by amount in radians.
toARGB32() int
Returns a 32-bit value representing this color.
inherited
toCmykColor() CmykColor

Available on Color, provided by the ToColorModel extension

Returns this color as a CmykColor.
toCmykColor() CmykColor
Converts this to the CMYK color space.
inherited
toColor() Color

Available on ColorModel, provided by the ToColor extension

Returns this as a Color, converting the color to RGB if necessary.
toColorModel() ColorModel

Available on Color, provided by the ToColorModel extension

If this is a ColorModel, return this, otherwise construct a new RgbColor from this Color.
toFactoredList() List<double>
Returns a fixed-length list containing the hue, saturation, and brightness values factored to be on 0 to 1 scale.
inherited
toFactoredListWithAlpha() List<double>
Returns a fixed-length list containing the hue, saturation, brightness, and alpha values factored to be on 0 to 1 scale.
inherited
toHsbColor() HsbColor

Available on Color, provided by the ToColorModel extension

Returns this color as a HsbColor.
toHsbColor() HsbColor
Converts this to the HSB color space.
toHsiColor() HsiColor

Available on Color, provided by the ToColorModel extension

Returns this color as a HsiColor.
toHsiColor() HsiColor
Converts this to the HSI color space.
inherited
toHslColor() HslColor

Available on Color, provided by the ToColorModel extension

Returns this color as a HslColor.
toHslColor() HslColor
Converts this to the HSL color space.
inherited
toHspColor() HspColor

Available on Color, provided by the ToColorModel extension

Returns this color as a HspColor.
toHspColor() HspColor
Converts this to the HSP color space.
inherited
toLabColor() LabColor
Converts this to the LAB color space.
inherited
toLabColor() LabColor

Available on Color, provided by the ToColorModel extension

Returns this color as a LabColor.
toList() List<num>
Returns a fixed-length list containing the hue, saturation, and brightness values, in that order.
inherited
toListWithAlpha() List<num>
Returns a fixed-length list containing the hue, saturation, brightness, and alpha values, in that order.
inherited
toOklabColor() OklabColor
Converts this to the Oklab color space.
inherited
toOklabColor() OklabColor

Available on Color, provided by the ToColorModel extension

Returns this color as an OklabColor.
toRgbColor() RgbColor
Converts this to the RGB color space.
inherited
toRgbColor() RgbColor

Available on Color, provided by the ToColorModel extension

Returns this color as a RgbColor.
toString() String
A string representation of this object.
inherited
toXyzColor() XyzColor

Available on Color, provided by the ToColorModel extension

Returns this color as a XyzColor.
toXyzColor() XyzColor
Converts this to the XYZ color space.
inherited
warmer(num amount, {bool relative = true}) HsbColor
Adjusts the hue of this color by amount towards 90 degrees, capping the value at 90.
withAlpha(int alpha) HsbColor
Returns this HsbColor modified with the provided alpha value.
withBlue(num blue) HsbColor
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) HsbColor
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) HsbColor
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) HsbColor
Returns this HsbColor modified with the provided hue value.
withOpacity(double opacity) HsbColor
Returns this ColorModel with the provided opacity value.
withRed(num red) HsbColor
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) HsbColor
Returns a color in this color's color space with the values provided.

Operators

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