def constrain_rgb(r, g, b):
 w = (- min([0, r, g, b]))
 if (w > 0):
  r += w
  g += w
  b += w
 return (r, g, b)

def constrain_rgb ( r , g , b ) : w = ( - min ( [ 0 , r , g , b ] ) ) if ( w > 0 ) : r += w g += w b += w return ( r , g , b )
if the requested rgb shade contains a negative weight for one of the primaries .