def lighten_color(color, amount):
    """
    Ligthen the color by a certain amount. Inspired by http://stackoverflow.com/questions/141855.
    :param color: a 3- or 4-tuple in range (0, 1)
    :param amount: value between (0, 1) defining how much brighter the resulting color should be
    :return: the lightened color
    """
    color_out = (min(1.0, color[0] + amount),
                 min(1.0, color[1] + amount),
                 min(1.0, color[2] + amount))
    if len(color) == 4:
        color_out += (color[3],)
    return color_out