2222
2323"""
2424
25+ try :
26+ from typing import Tuple
27+ except ImportError :
28+ pass
29+
2530__all__ = ["hls_to_rgb" , "hsv_to_rgb" ]
2631
2732# Some floating point constants
3641# S: color saturation
3742
3843
39- def hls_to_rgb (hue , light , sat ) :
44+ def hls_to_rgb (hue : float , light : float , sat : float ) -> Tuple [ float , float , float ] :
4045 """ Converts HLS to RGB values """
4146 if sat == 0.0 :
4247 return light , light , light
@@ -52,7 +57,7 @@ def hls_to_rgb(hue, light, sat):
5257 )
5358
5459
55- def _v (chroma1 , chroma2 , hue ) :
60+ def _v (chroma1 : float , chroma2 : float , hue : float ) -> float :
5661 hue = hue % 1.0
5762 if hue < ONE_SIXTH :
5863 return chroma1 + (chroma2 - chroma1 ) * hue * 6.0
@@ -70,8 +75,8 @@ def _v(chroma1, chroma2, hue):
7075
7176
7277def 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 ] :
7580 """ Converts HSV to RGB values """
7681 if sat == 0.0 :
7782 return val , val , val
0 commit comments