version between HLS and RGB and vice-versa:</p><pre>
Public Sub RGBToHLS( _ 
    ByVal r As Long, ByVal g As Long, ByVal b As Long, _ 
    h As Single, s As Single, l As Single _ 
    ) 
Dim Max As Single 
Dim Min As Single 
Dim delta As Single 
Dim rR As Single, rG As Single, rB As Single 

    rR = r / 255: rG = g / 255: rB = b / 255 

    '{Given: rgb each in [0,1]. 
    ' Desired: h in [0,360] and s in [0,1], except if s=0, then h=UNDEFINED.} 
    Max = Maximum(rR, rG, rB) 
    Min = Minimum(rR, rG, rB)