 
    l = (Max + Min) / 2'{This is the lightness} 
        
    '{Next calculate saturation} 
    If Max = Min Then 
        'begin {Acrhomatic case} 
        s = 0 
        h = 0 
        'end {Acrhomatic case} 
    Else 
        'begin {Chromatic case} 
        '{First calculate the saturation.} 
        If l &lt;= 0.5 Then 
            s = (Max - Min) / (Max + Min) 
        Else 
            s = (Max - Min) / (2 - Max - Min) 
        End If 
        '{Next calculate the hue.} 
        delta = Max - Min 
