HSVColour class

A colour represented in the HSV (Hue, Saturation, Value) colour space.

HSV is a cylindrical model where:

  • Hue (0-360) is the colour angle on the colour wheel.
  • Saturation (0.0-1.0) is the purity/intensity of the colour.
  • Value (0.0-1.0) is the brightness, from black (0) to full colour (1).

HSV is often preferred for colour pickers because it maps intuitively to how humans think about colour selection — pick a hue, then adjust how vivid and how bright it should be.

HSVColour implements Flutter's HSVColor interface, so it works anywhere Flutter expects an HSVColor.

Creating

final hsv = HSVColour(hue: 120, saturation: 1.0, value: 0.8);
final fromColour = HSVColour.fromColour(someColour);
final fromFlutter = HSVColour.fromColor(Colors.green);

Converting

final colour = hsv.toColour();  // → Colour (ARGB)
final hsl = hsv.toHSL();        // → HSLColour
final color = hsv.toColor();     // → Flutter Color
Inheritance
Implemented types
Available extensions

Constructors

HSVColour({double alpha = 1.0, double hue = 360, double saturation = 1.0, double value = 1})
const
HSVColour.fromAHSV(double alpha, double hue, double saturation, double value)
const
HSVColour.fromColor(Color color)
factory
HSVColour.fromColour(Colour colour)
factory
HSVColour.fromHSLColour(HSLColour hsl)
factory
HSVColour.fromHSVColor(HSVColor hsvColor)

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 setterinherited
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
toHSVColour HSVColour

Available on HSVColor, provided by the Hsvcolour extension

Returns this HSVColor as a Collect HSVColour.
no setter
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.
override
toColour() Colour
Converts this colour to its Colour (ARGB) representation.
override
toHSL() HSLColour
Converts this colour to its HSLColour representation.
override
toHSV() HSVColour
Converts this colour to its HSVColour representation.
override
toString() String
A string representation of this object.
override
withAlpha(double alpha) HSVColour
Returns a copy of this color with the alpha parameter replaced with the given value.
override
withHue(double hue) HSVColour
Returns a copy of this color with the hue parameter replaced with the given value.
override
withSaturation(double saturation) HSVColour
Returns a copy of this color with the saturation parameter replaced with the given value.
override
withValue(double value) HSVColour
Returns a copy of this color with the value parameter replaced with the given value.
override

Operators

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