HSL
  • 18 May 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

HSL

  • Dark
    Light
  • PDF

Generate a color based on the values of the given hue, saturation, lightness and alpha components. Returns a text representing a valid color, or null if the color cannot be generated.

Function signature

HSL(hue: Number, saturation: Number, lightness: Number, alpha: Number = 1) => String
Parameter Description
Hue Hue component (0…360)
Saturation Saturation component (0…1)
Lightness Lightness component (0…1)
Alpha Alpha component (0…1)

Examples

Formula Return value
HSL(10, 0.2, 0.3) rgb(92,66,61)
HSL(10, 0.2, 0.3, 0.5) rgba(92,66,61,0.5)
HSL(500, 500, 500, 500) rgb(255,0,255)

Was this article helpful?

What's Next