22
22
23
23
"""
24
24
25
+ try :
26
+ from typing import Tuple
27
+ except ImportError :
28
+ pass
29
+
25
30
__all__ = ["hls_to_rgb" , "hsv_to_rgb" ]
26
31
27
32
# Some floating point constants
36
41
# S: color saturation
37
42
38
43
39
- def hls_to_rgb (hue , light , sat ) :
44
+ def hls_to_rgb (hue : float , light : float , sat : float ) -> Tuple [ float , float , float ] :
40
45
""" Converts HLS to RGB values """
41
46
if sat == 0.0 :
42
47
return light , light , light
@@ -52,7 +57,7 @@ def hls_to_rgb(hue, light, sat):
52
57
)
53
58
54
59
55
- def _v (chroma1 , chroma2 , hue ) :
60
+ def _v (chroma1 : float , chroma2 : float , hue : float ) -> float :
56
61
hue = hue % 1.0
57
62
if hue < ONE_SIXTH :
58
63
return chroma1 + (chroma2 - chroma1 ) * hue * 6.0
@@ -70,8 +75,8 @@ def _v(chroma1, chroma2, hue):
70
75
71
76
72
77
def hsv_to_rgb ( # pylint: disable=too-many-return-statements,inconsistent-return-statements
73
- hue , sat , val
74
- ):
78
+ hue : float , sat : float , val : float
79
+ ) -> Tuple [ float , float , float ] :
75
80
""" Converts HSV to RGB values """
76
81
if sat == 0.0 :
77
82
return val , val , val
0 commit comments