e, ByVal l As Single, _ 
    r As Long, g As Long, b As Long _ 
    ) 
Dim rR As Single, rG As Single, rB As Single 
Dim Min As Single, Max As Single 

    If s = 0 Then 
        ' Achromatic case: 
        rR = l: rG = l: rB = l 
    Else 
        ' Chromatic case: 
        ' delta = Max-Min 
        If l &lt;= 0.5 Then 
            's = (Max - Min) / (Max + Min) 
            ' Get Min value: 
            Min = l * (1 - s) 
        Else 
            's = (Max - Min) / (2 - Max - Min) 
            ' Get Min