(led_count: int, offset: float = 0)
return [f((offset + led / led_count) % 1) % 1 for led in range(0, led_count)]
Stretches red and blue, compresses green and pink.
Stretches red and blue, compresses green and pink.
Stretches red and blue compresses green and pink .
def stretched_hues(led_count: int, offset: float = 0):
    """Stretches red and blue, compresses green and pink."""
    # Uses the logistic curve to make colors more prominent and compress the others
    #
    #  ^ out hue
    # 1-        xx
    #  |       x
    #  |     xx
    #  |    x
    #  |   x
    #  |   x
    #  |  x
    #  |xx
    #  -|--|--|--|> in hue
    #   R  G  B  R
    #
    # Two logistic curves are combined to compress two colors (green and pink).
    # Green is compressed because the board is green and visible anyway.
    # Pink just does not look that good.

    M1 = 2 / 3
    M2 = 1 / 3

    def f(x):
        # First curve, compresses green (hue = ⅓)
        def L1(x):
            return M1 / (1 + math.e ** (-16 * (x - 1 / 3)))

        # First curve, compresses pink (hue = ⅚)
        def L2(x):
            return M2 / (1 + math.e ** (-16 * (x - 5 / 6)))

        if x < 2 / 3:
            # Vertically stretch and move the curve so it starts at y=0 and ends at y=M
            y0 = L1(0)
            scale = M1 / (M1 - 2 * y0)
            return scale * (L1(x) - y0)
        else:
            y0 = L2(2 / 3)
            scale = M2 / (M2 - 2 * y0)
            return scale * (L2(x) - y0) + M1

    return [f((offset + led / led_count) % 1) % 1 for led in range(0, led_count)]
def stretched_hues ( led_count : int , offset : float = 0 ) : # Uses the logistic curve to make colors more prominent and compress the others # #  ^ out hue # 1-        xx #  |       x #  |     xx #  |    x #  |   x #  |   x #  |  x #  |xx #  -|--|--|--|> in hue #   R  G  B  R # # Two logistic curves are combined to compress two colors (green and pink). # Green is compressed because the board is green and visible anyway. # Pink just does not look that good. M1 = 2 / 3 M2 = 1 / 3 def f ( x ) : # First curve, compresses green (hue = ⅓) def L1 ( x ) : return M1 / ( 1 + math . e ** ( - 16 * ( x - 1 / 3 ) ) ) # First curve, compresses pink (hue = ⅚) def L2 ( x ) : return M2 / ( 1 + math . e ** ( - 16 * ( x - 5 / 6 ) ) ) if x < 2 / 3 : # Vertically stretch and move the curve so it starts at y=0 and ends at y=M y0 = L1 ( 0 ) scale = M1 / ( M1 - 2 * y0 ) return scale * ( L1 ( x ) - y0 ) else : y0 = L2 ( 2 / 3 ) scale = M2 / ( M2 - 2 * y0 ) return scale * ( L2 ( x ) - y0 ) + M1 return [ f ( ( offset + led / led_count ) % 1 ) % 1 for led in range ( 0 , led_count ) ]