ColorHSV

class ColorHSV(*args)

Bases: Color

Create an HSV color by passing hue (0-360), saturation (0-1), value (0-1) and optionally, alpha (0-1)

Convert another color object to HSV by passing it as a parameter.

Raises
  • TypeError – hue must be an int, saturation, value, and alpha must be floats

  • ValueError – hue must be between 0-360, saturation, value, and alpha must be between 0-1

Examples

>>> ColorHSV(90, 0.2, 0.2)
ColorHSV(90, 0.2, 0.2)
>>> ColorHSV(240, 0.8, 0.9, 0.5)
ColorHSV(240, 0.8, 0.9)
>>> ColorHSV(other_color)
__add__(other: Union[int, Color]) Color

Adds an integer value to the RGB components of the color, or adds the RGB components of another color supplied. You can also use in-place addition.

Examples

>>> Color(120, 50, 60) + 5  # increases the brightness by 5 points
Color(125, 55, 65)
>>> Color(15, 20, 30) + Color(60, 5, 30)
Color(75, 25, 60)
Return type

Color

__sub__(other: Union[int, Color]) Color

Subtracts an integer value from the RGB components of the color, or subtracts the RGB components of another color supplied. You can also use in-place subtraction.

Examples

>>> Color(120, 50, 60) - 5  # decreases the brightness by 5 points
Color(115, 45, 55)
>>> Color(60, 80, 100) - Color(10, 20, 30)
Color(50, 60, 70)
Return type

Color

property hue: int
property saturation: float
property value: float
property red: int
property green: int
property blue: int
property alpha: float