Class HSV

This class represents a HSV color value.

Constructor

cornell.HSV(h, s, v)

Constructor: creates a new HSV color (h,s,v).

Parameter:
  • h (float between 0.0 and 360.0, not including 360.0) – the initial hue
  • s (float between 0.0 and 1.0, inclusive.) – the initial saturation
  • v (float between 0.0 and 1.0, inclusive.) – initial brightness value

No arguments are optional.

Attributes

hue

The hue channel.

Invariant: Value must be a float between 0.0 and 360.0, not including 360.0.

saturation

The staturation channel.

Invariant: Value must be a float between 0.0 and 1.0, inclusive.

value

The value channel.

Invariant: Value must be a float between 0.0 and 1.0, inclusive.

Methods

glColor()

Returns: a 4 element list of the equivalent rgba color.

This method converts this object to an RGB object and then extracts a 4 element list with color values between 0 and 1. This is a conversion of this object into a format that can be used in openGL graphics

tkColor()

Returns: a 3 element tuple of the equivalent rgb color.

This method converts this object to an RGB object and then extracts a 3 element tuple with color values between 0 and 1. This is a conversion of this object into a format that can be used by the drawing turtle