HSVColor class

A color represented using alpha, hue, saturation, and value.

An HSVColor is represented in a parameter space that's based on human perception of color in pigments (e.g. paint and printer's ink). The representation is useful for some color computations (e.g. rotating the hue through the colors), because interpolation and picking of colors as red, green, and blue channels doesn't always produce intuitive results.

The HSV color space models the way that different pigments are perceived when mixed. The hue describes which pigment is used, the saturation describes which shade of the pigment, and the value resembles mixing the pigment with different amounts of black or white pigment.

See also:

  • HSLColor, a color that uses a color space based on human perception of colored light.
  • HSV and HSL Wikipedia article, which this implementation is based upon.

Based into: https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/painting/colors.dart

Constructors

HSVColor.fromAHSV(double alpha, double hue, double saturation, double value)
Creates a color.
const
HSVColor.fromColor(Color color)
Creates an HSVColor from an RGB Color.
factory

Properties

alpha double
Alpha, from 0.0 to 1.0. The describes the transparency of the color. A value of 0.0 is fully transparent, and 1.0 is fully opaque.
final
hashCode int
The hash code for this object.
no setteroverride
hue double
Hue, from 0.0 to 360.0. Describes which color of the spectrum is represented. A value of 0.0 represents red, as does 360.0. Values in between go through all the hues representable in RGB. You can think of this as selecting which pigment will be added to a color.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
saturation double
Saturation, from 0.0 to 1.0. This describes how colorful the color is. 0.0 implies a shade of grey (i.e. no pigment), and 1.0 implies a color as vibrant as that hue gets. You can think of this as the equivalent of how much of a pigment is added.
final
value double
Value, from 0.0 to 1.0. The "value" of a color that, in this context, describes how bright a color is. A value of 0.0 indicates black, and 1.0 indicates full intensity color. You can think of this as the equivalent of removing black from the color as value increases.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toColor() Color
Returns this color in RGB.
toString() String
A string representation of this object.
override
withAlpha(double alpha) HSVColor
Returns a copy of this color with the alpha parameter replaced with the given value.
withHue(double hue) HSVColor
Returns a copy of this color with the hue parameter replaced with the given value.
withSaturation(double saturation) HSVColor
Returns a copy of this color with the saturation parameter replaced with the given value.
withValue(double value) HSVColor
Returns a copy of this color with the value parameter replaced with the given value.

Operators

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

Static Methods

lerp(HSVColor? a, HSVColor? b, double t) HSVColor?
Linearly interpolate between two HSVColors.