ps1
    Preparing search index...

    Function fillGradient

    • Fill in a multicolor gradient that transitions between the provided colors in the specified steps. All colors are [r,g,b] tuples of integers 0 <= r,g,b <= 255.

      For example, given:

      • { 0: [0,0,252], 3: [0,126,0], 5: [254,0,0] }

      Modifies the input to contain:

      • { 0: [0,0,252], 1: [0,42,168], 2: [0,84,84], 3: [0,126,0], 4: [127,63,0], 5: [254,0,0] }

      and returns 3.

      Parameters

      • colors: Map<number, Color>

        a map of integer keys to RGB colors, not containing keys that differ by more than 2^10, mutated so that its keys are the integers from the lowest to highest initial keys, inclusive, and each key k maps to the RGB color:

        • colors[k] if k is initially a key in colors
        • otherwise, letting prev and next be the nearest lower and higher initial keys, respectively, the linear interpolation between colors[prev] and colors[next], rounded (half up), at t equal to k's fractional distance from prev to next

      Returns number

      the number of keys added to colors