def norm_rgb(r, g, b):
    """
    Normalise RGB components so the most intense (unless all
    are zero) has a value of 1.
    """
    greatest = max([r, g, b])
    if greatest > 0:
        r /= greatest
        g /= greatest
        b /= greatest
    return r, g, b
