HSL is a color representation method that describes colors using three components: Hue, Saturation, and Lightness. Unlike RGB, which specifies the intensity of red, green, and blue, HSL describes a color in terms that can be easier to understand when making adjustments, such as "what color is it?", "how vivid is it?", and "how light or dark is it?"
HSL is widely used in web design and CSS, and it can be useful when creating color variations or adjusting brightness and saturation. For example, if you want to create lighter, darker, or softer variations of the same blue, HSL can make these adjustments relatively intuitive.
- What HSL is and how it represents colors
- What Hue, Saturation, and Lightness mean
- How to read HSL values
- The differences between HSL, RGB, and HEX
- The differences between HSL, HSV, and HSB
- How to use HSL in CSS
- The advantages and disadvantages of HSL
- How HSL can be used in web design
- How to adjust colors using HSL
What Is HSL?
HSL is a color representation method that describes colors using three components. The name HSL comes from the first letters of the following three English words:
- H = Hue
- S = Saturation
- L = Lightness
RGB represents colors by specifying the intensity of red, green, and blue. In contrast, HSL specifies a color using values such as Hue in degrees, Saturation in percent, and Lightness in percent.
This makes HSL convenient for adjustments such as "make this blue a little lighter" or "make this red less saturated."
The Three Components of HSL
In HSL, colors are represented using three values: Hue, Saturation, and Lightness.
| Component | Meaning | What It Represents | Typical Range |
|---|---|---|---|
| Hue | Hue | Type of color | 0–360 degrees |
| Saturation | Saturation | Color vividness | 0–100% |
| Lightness | Lightness | Lightness of the color | 0–100% |
By combining these three values, a wide variety of colors can be represented. For example:
hsl(210, 100%, 50%)
This represents a color with a Hue of 210 degrees, Saturation of 100%, and Lightness of 50%.
What Is Hue?
Hue represents the type or family of a color, such as red, yellow, green, blue, or purple. In HSL, Hue is specified as an angle around a color wheel, using values from 0 to 360 degrees.
| Approximate Hue | Representative Color |
|---|---|
| 0° | Red |
| 60° | Yellow |
| 120° | Green |
| 180° | Cyan |
| 240° | Blue |
| 300° | Magenta |
| 360° | Red |
Because 0° and 360° represent the same position on the color wheel, both correspond to the red area of the Hue scale.
By changing only the Hue value while keeping Saturation and Lightness constant, you can change the color family from red to yellow, green, blue, and so on.
What Happens When You Change Hue?
For example:
hsl(0, 100%, 50%)
represents a vivid red. If you change only the Hue value:
hsl(120, 100%, 50%)
the result becomes green.
This is one of the useful characteristics of HSL: changing the Hue value allows you to change the color family while keeping the other two values unchanged.
What Is Saturation?
Saturation represents how vivid or intense a color is. In HSL, Saturation is specified from 0% to 100%.
- 0% → Achromatic gray
- 50% → Moderate saturation
- 100% → Maximum saturation
For example, if you keep Hue and Lightness constant and change only Saturation, you can create variations ranging from vivid colors to more muted colors.
At 0% Saturation, the Color Becomes Gray
When Saturation is set to 0% in HSL, the color becomes a shade of gray regardless of the Hue value. For example:
hsl(0, 0%, 50%)
hsl(200, 0%, 50%)
hsl(300, 0%, 50%)
all produce the same medium gray.
This happens because a Saturation of 0% removes the color component, so differences in Hue are no longer visible.
What Is Lightness?
Lightness represents how light or dark a color is. In HSL, Lightness is specified from 0% to 100%.
- 0% → Black
- 50% → A central lightness level for the selected Hue and Saturation
- 100% → White
In HSL, setting Lightness to 0% produces black regardless of Hue or Saturation. Setting Lightness to 100% produces white.
This means that if you want to make a color slightly darker or lighter, you can adjust the Lightness value while keeping the Hue and Saturation unchanged.
Lightness at 50%
A Lightness value of 50% is commonly used as the central point for a color determined by its Hue and Saturation. For example:
hsl(0, 100%, 50%)
represents a vivid red. If you lower the Lightness to 30%:
hsl(0, 100%, 30%)
the result is a darker red. If you increase the Lightness to 70%:
hsl(0, 100%, 70%)
the result is a lighter red.
In this way, you can create light and dark variations based on the same Hue by changing the Lightness value.
How Is HSL Written?
HSL is commonly written in the following format:
hsl(H, S%, L%)
Each value has the following meaning:
| Value | Meaning | Range |
|---|---|---|
| H | Hue | 0–360 degrees |
| S | Saturation | 0–100% |
| L | Lightness | 0–100% |
Example
For example:
hsl(120, 100%, 50%)
means:
- Hue: 120 degrees
- Saturation: 100%
- Lightness: 50%
Hue 120° corresponds to the green area of the color wheel, so this value represents a vivid green.
HSL Can Be Thought of as a Color Design Formula
Rather than thinking of HSL as directly specifying a physical color, it can be helpful to think of it as a numerical description of what color it is, how saturated it is, and how light or dark it is.
For example:
hsl(210, 100%, 50%)
can be used as a base color. By changing only the Lightness:
hsl(210, 100%, 40%)
you can create a darker variation based on the same Hue and Saturation.
HSL vs. RGB and HEX
HSL, RGB, and HEX are all used to represent colors in digital environments, but they specify colors in different ways.
What Is RGB?
RGB represents a color by combining different intensities of three primary light channels: Red, Green, and Blue.
For example:
rgb(255, 0, 0)
represents red.
RGB is closely related to how digital displays and image data represent colors, and it is widely used in computers, displays, and digital images.
What Is HEX?
A HEX color code represents RGB channel values using hexadecimal notation.
For example, red can be represented as:
#FF0000
HEX color codes are widely used for specifying colors in CSS and web development.
How Is HSL Different?
RGB and HEX specify colors based on the amounts of red, green, and blue. HSL, on the other hand, specifies colors using Hue, Saturation, and Lightness.
As a result, HSL can be convenient when adjusting brightness or saturation during web design because those properties can be changed independently.
HSL vs. HSV and HSB
HSV and HSB are color representation methods that are similar to HSL. They also separate Hue from measures related to color intensity or brightness, but the meaning and calculation of the third component are different.
| Format | First | Second | Third |
|---|---|---|---|
| HSL | Hue | Saturation | Lightness |
| HSV | Hue | Saturation | Value |
| HSB | Hue | Saturation | Brightness |
HSL's "Lightness" and HSV's "Value" are not the same thing. Therefore, even if you use similar numerical values, HSL and HSV can produce different colors.
Which Is Better, HSL or HSV?
Neither is universally better. They are used for different purposes depending on the application.
HSL can be convenient for web development and CSS, while HSV or HSB is commonly used in some image-editing applications and design tools.
How to Use HSL in CSS
HSL can be used directly to specify colors in CSS. The basic syntax is:
color: hsl(210, 100%, 50%);
This example specifies the text color using HSL.
Using HSL for a Background Color
HSL can also be used for background colors.
background-color: hsl(210, 100%, 50%);
Using HSL for Text Color
color: hsl(210, 100%, 50%);
Using HSL for Borders
border: 2px solid hsl(210, 100%, 50%);
Specifying Transparency
CSS also allows HSL colors to be combined with an alpha value for transparency. For example, modern CSS syntax can be written as:
background-color: hsl(210 100% 50% / 50%);
The value after the slash specifies the alpha component, allowing you to control the transparency of the color.
An older syntax is also supported:
hsla(210, 100%, 50%, 0.5);
This notation uses hsla() to specify the color and alpha value.
- Hue is specified from 0 to 360 degrees
- Saturation is specified from 0% to 100%
- Lightness is specified from 0% to 100%
- HSL makes it convenient to create color variations
- HSL can be combined with transparency
Advantages and Disadvantages of HSL
Advantages of HSL
- Hue provides an intuitive way to specify the color family
- Saturation can be adjusted independently
- Lightness can be adjusted independently
- It is convenient for creating variations based on the same color
- It can be used directly in CSS
- It can be useful for adjusting theme colors
Disadvantages of HSL
- It may take some time to become familiar with the three parameters
- HSL Lightness does not perfectly correspond to perceived brightness
- HSL and HSV can produce different results even with similar-looking values
- Different color models are commonly used in printing workflows
What Is HSL Useful For?
HSL is particularly useful when adjusting colors in web design and CSS.
Website Theme Colors
Websites often need several variations of a main theme color, such as lighter and darker versions. With HSL, you can change Lightness while keeping Hue and Saturation constant, making it convenient to create variations of a theme color.
Button Colors
HSL can also be useful when creating different button states, such as normal, hover, and active states.
For example, a normal button could use:
hsl(210, 100%, 50%)
while the hover state could use:
hsl(210, 100%, 45%)
This creates a slightly darker color while keeping the Hue and Saturation unchanged.
Creating Color Palettes
With HSL, you can create multiple colors based on the same Hue by adjusting Saturation and Lightness. This can be useful when designing a color palette for a website.
Hover and Active States
Links and buttons often use slightly darker or lighter versions of their original colors for hover and active states. HSL makes it convenient to create these variations by adjusting the Lightness value.
Dark Mode
Dark mode requires backgrounds and text colors to be adjusted for a darker visual environment. Using HSL can make it easier to manage light and dark variations of theme colors by adjusting Lightness while maintaining a consistent Hue.
How to Adjust Colors with HSL
One of the main characteristics of HSL is that you can adjust its three values independently.
When You Want to Change the Color
If you want to change the color family itself, change the Hue (H) value.
For example:
hsl(0, 100%, 50%)
If you want to change this red toward blue, change the Hue to around 240 degrees:
hsl(240, 100%, 50%)
When You Want a More Vivid Color
If you want to make a color more vivid, increase the Saturation (S).
For example, changing:
hsl(210, 50%, 50%)
to:
hsl(210, 100%, 50%)
creates a more saturated color.
When You Want a Softer or More Muted Color
Lowering the Saturation can create a softer and more muted version of a color.
hsl(210, 30%, 50%)
When You Want a Lighter Color
If you want to change how light or dark the color is, adjust the Lightness (L).
For example:
hsl(210, 100%, 40%)
is darker than:
hsl(210, 100%, 60%)
The second color has a higher Lightness value and therefore appears lighter.
When You Want a Darker Color
Lowering the Lightness creates a darker variation.
hsl(210, 100%, 30%)
- Change the color → H (Hue)
- Change vividness → S (Saturation)
- Change lightness → L (Lightness)
Comparison of HSL, RGB, HEX, and HSV
HSL, RGB, HEX, and HSV represent colors in different ways and are useful in different situations.
| Comparison | HSL | RGB | HEX | HSV |
|---|---|---|---|---|
| Basic components | Hue, Saturation, Lightness | Red, Green, Blue | RGB values in hexadecimal | Hue, Saturation, Value |
| Color adjustment | ◎ | ○ | ○ | ◎ |
| Lightness adjustment | ◎ | △ | △ | ○ |
| Web design | ◎ | ◎ | ◎ | ○ |
| CSS support | ◎ | ◎ | ◎ | △ |
| Ease of understanding for humans | ◎ | ○ | △ | ◎ |
| Common uses | Color adjustment and web design | Displays and image data | Web color specification | Color selection and image editing |
Should You Use HSL or HEX?
When creating a website, you may wonder whether HSL or HEX is the better choice. Both have useful characteristics, so the appropriate format depends on what you are trying to do.
| Use Case | Suitable Format | Reason |
|---|---|---|
| Adjusting color lightness | HSL | Lightness can be adjusted directly |
| Adjusting color saturation | HSL | Saturation can be adjusted directly |
| Managing theme colors in CSS | HSL | It is convenient for creating color variations |
| General web color specification | HEX | It is widely used in web development |
| Colors in image data | RGB | RGB is widely used for digital images |
| Color selection and adjustment | HSL / HSV | Color changes can be easier to work with |
Things to Keep in Mind When Using HSL
HSL Lightness Does Not Perfectly Match Perceived Brightness
HSL Lightness provides a convenient numerical way to describe how light or dark a color is, but it does not perfectly represent how bright a color appears to human vision.
Even when two colors have the same Lightness value, they may appear to have different brightness depending on their Hue.
Color Appearance Can Also Vary Between Displays
Even when the same HSL values are used, the appearance of a color can vary depending on display settings and viewing conditions.
When selecting colors for a website, it is therefore important to check the actual appearance rather than relying only on numerical values.
HSL and HSV Are Not the Same
HSL and HSV both use a structure based on Hue, Saturation, and a third component related to lightness or brightness, but their calculations are different. Therefore:
hsl(210, 100%, 50%)
and similar-looking HSV values do not necessarily produce the same color.
Frequently Asked Questions
What is HSL?
HSL is a color representation method that describes colors using three components: Hue, Saturation, and Lightness. It is commonly used in web design and CSS.
What do H, S, and L mean in HSL?
H stands for Hue, S stands for Saturation, and L stands for Lightness.
Why does HSL use 360 degrees for Hue?
Hue is represented as an angle around a color wheel, so it is specified from 0 to 360 degrees. 0° and 360° represent the same position on the color wheel.
What color is 0% Saturation in HSL?
At 0% Saturation, the color component is removed, so the result is a shade of gray determined by the Lightness value. At 0% Lightness it is black, at 50% it is medium gray, and at 100% it is white.
What does 50% Lightness mean in HSL?
In HSL, 50% Lightness is commonly used as the central Lightness level for the selected Hue and Saturation. However, the perceived brightness of the resulting color can vary depending on the Hue.
Can HSL be used in CSS?
Yes. CSS allows you to specify colors using HSL, for example:
color: hsl(210, 100%, 50%);
This directly sets the text color using an HSL value.
Is HSL or RGB better?
Neither is universally better. HSL can be convenient when you want to adjust color lightness or saturation, while RGB is widely used for digital color representation, including images and displays.
What is the difference between HSL and HEX?
HEX represents RGB channel values using hexadecimal notation. HSL represents colors using Hue, Saturation, and Lightness. When creating color variations, HSL can sometimes be more intuitive because Hue, Saturation, and Lightness can be adjusted separately.
Summary
HSL is a color representation method that describes colors using three components: Hue, Saturation, and Lightness. Unlike RGB and HEX, HSL separates the color family, saturation, and lightness into different values, which can make color adjustments easier to understand.
- H = Hue
- S = Saturation
- L = Lightness
- Hue is specified from 0 to 360 degrees
- Saturation is specified from 0% to 100%
- Lightness is specified from 0% to 100%
- HSL colors can be specified directly in CSS
- HSL is useful for creating color variations
HSL can be particularly useful in web design when you need to create lighter, darker, more vivid, or more muted variations of a theme color.
Color representations such as RGB, HEX, HSL, and HSV each have different characteristics and use cases. Understanding how these formats work can help you work more efficiently with website color schemes and CSS color adjustments.
Related Tools
- Color Picker : Check colors from images or your screen and obtain color codes
- Color Code List : Browse color codes that can be used in HTML and CSS