Function goldenAngleColour

Returns a full HSL colour string (eg hsl(20,50%,75%)) based on a index. It's useful for generating perceptually different shades as the index increments.

el.style.backgroundColor = goldenAgeColour(10);

Saturation and lightness can be specified, as numeric ranges of 0-1.

  • Parameters

    • index: number
    • saturation: number = 0.5

      Saturation (0-1), defaults to 0.5

    • lightness: number = 0.75

      Lightness (0-1), defaults to 0.75

    • alpha: number = 1

      Opacity (0-1), defaults to 1.0

    Returns string

    HSL colour string eg hsl(20,50%,75%)