loading

HSL


Hue, saturation, and lightness make up the acronym HSL.


HSL Color Values

Hue, saturation, and lightness (HSL) specifications for colors in CSS can take the following form:

hsl (hue, saturation, lightness)

On the color wheel, hue ranges from 0 to 360 degrees. Red is 0, green is 120, and blue is 240.

Saturation is expressed as a percentage. 100% represents the entire color, whereas 0% is a grayscale shade.

Lightness has a proportion as well. 50% are neither light nor dark, 100% are white, and 0% are black.

Play around with the HSL values shown below:

hsl(0, 100%, 50%)

HUE

0

SATURATION

100%

LIGHTNESS

50%

Example

hsl(0, 100%, 50%)
hsl(240, 100%, 50%)
hsl(147, 50%, 47%)
hsl(300, 76%, 72%)
hsl(39, 100%, 50%)
hsl(248, 53%, 58%)

Saturation

A color’s intensity can be defined as saturation.

100% is full color—there are no grayscales.

50% is gray, yet the hue is still discernible.

You can no longer discern the color at 0% since it is entirely gray.

Example

hsl(0, 100%, 50%)
hsl(0, 80%, 50%)
hsl(0, 60%, 50%)
hsl(0, 40%, 50%)
hsl(0, 20%, 50%)
hsl(0, 0%, 50%)

Lightness

A color’s brightness can be defined as the amount of light you wish to add to it; 0% represents no light at all (black), 50% represents half of the light (neither dark nor light), and 100% represents full lightness (white).

Example

hsl(0, 100%, 0%)
hsl(0, 100%, 25%)
hsl(0, 100%, 50%)
hsl(0, 100%, 75%)
hsl(0, 100%, 90%)
hsl(0, 100%, 100%)

Shades of Gray

In order to define shades of gray, one commonly sets the hue and saturation to 0, then modifies the brightness from 0% to 100% to obtain darker or lighter shades:

Example

hsl(0, 0%, 20%)
hsl(0, 0%, 30%)
hsl(0, 0%, 40%)
hsl(0, 0%, 60%)
hsl(0, 0%, 70%)
hsl(0, 0%, 90%)

HSLA Color Values

The alpha channel, which determines a color’s opacity, is added to HSL color values to create HSLA color values.

An HSLA color value is expressed as follows:

hue, saturation, lightness, and alpha (hsla).

A number between 0.0 (complete transparency) and 1.0 (complete transparency) is the alpha parameter:

Mix the following HSLA values to conduct an experiment:

hsla(0, 100%, 50%, 0.5)

HUE

0

SATURATION

100%

LIGHTNESS

50%

ALPHA

0.5

Example

hsla(9, 100%, 64%, 0)
hsla(9, 100%, 64%, 0.2)
hsla(9, 100%, 64%, 0.4)
hsla(9, 100%, 64%, 0.6)
hsla(9, 100%, 64%, 0.8)
hsla(9, 100%, 64%, 1)
Share this Doc

HSL

Or copy link

Explore Topic