Angles API¶
Some color representations use angles as some of their properties. The base class for angles is the following:
- class thcolor.angles.Angle¶
Abstract class representing an angle within thcolor.
Used for some color representations (most notably hue).
- asdegrees()¶
Get the current angle as a degrees angle.
- Return type
- asgradians()¶
Get the current angle as a gradians angle.
- Return type
- asprincipal()¶
Get the principal angle.
- asradians()¶
Get the current angle as a radians angle.
- Return type
- asturns()¶
Get the current angle as a turns angle.
- Return type
Subclasses are the following:
- class thcolor.angles.DegreesAngle(degrees)¶
An angle expressed in degrees.
A 270° angle can be created the following way:
angle = DegreesAngle(270)
- Parameters
degrees (
float
) – Degrees; canonical values are between 0 and 360 excluded.
- property degrees: float¶
Degrees.
- Return type
float
- class thcolor.angles.GradiansAngle(gradians)¶
An angle expressed in gradians.
A 565.5 gradians angle can be created the following way:
angle = GradiansAngle(565.5)
- Parameters
gradians (
float
) – Gradians; canonical values are between 0 and 400.0 excluded.
- property gradians: float¶
Gradians.
- Return type
float
- class thcolor.angles.RadiansAngle(radians)¶
An angle expressed in radians.
A π radians angle can be created the following way:
from math import pi angle = RadiansAngle(pi)
- Parameters
radians (
float
) – Radians; canonical are between 0 and 2π excluded.
- property radians: float¶
Radians.
- Return type
float