Learn about the HSL (Hue, Saturation, Lightness) color model and how it provides an intuitive way to work with colors in web design.
HSL (Hue, Saturation, Lightness) is an intuitive color model that represents colors in a way that closely matches human color perception. Unlike RGB or HEX, HSL separates color information into three distinct, easily understood components, making it particularly valuable for designers and developers who need to create, modify, and understand color relationships.
Hue represents the pure color and is measured as a position on the color wheel from 0° to 360°:
Saturation controls how vivid or muted the color appears, expressed as a percentage:
Lightness determines how light or dark the color appears:
/* Basic HSL syntax */
color: hsl(240, 100%, 50%); /* Pure blue */
background: hsl(120, 75%, 40%); /* Forest green */
/* HSL with alpha (transparency) */
color: hsla(0, 100%, 50%, 0.8); /* Semi-transparent red */
background: hsla(240, 50%, 25%, 0.5); /* Translucent dark blue */
/* Creating a color palette from a base hue */
:root {
--primary-hue: 240;
--primary: hsl(var(--primary-hue), 100%, 50%);
--primary-light: hsl(var(--primary-hue), 100%, 75%);
--primary-dark: hsl(var(--primary-hue), 100%, 25%);
--primary-muted: hsl(var(--primary-hue), 50%, 50%);
}
Colors opposite on the color wheel (180° apart):
/* Blue and orange complementary pair */
.primary { color: hsl(240, 100%, 50%); } /* Blue */
.accent { color: hsl(60, 100%, 50%); } /* Orange */
Colors adjacent on the color wheel (30° apart):
/* Blue-green analogous scheme */
.color-1 { color: hsl(180, 100%, 50%); } /* Cyan */
.color-2 { color: hsl(210, 100%, 50%); } /* Light blue */
.color-3 { color: hsl(240, 100%, 50%); } /* Blue */
HSL makes it easier to ensure sufficient contrast ratios:
/* Ensuring readable text on colored backgrounds */
.dark-bg {
background: hsl(240, 100%, 20%); /* Dark blue background */
color: hsl(240, 100%, 90%); /* Light blue text */
}
.light-bg {
background: hsl(240, 100%, 90%); /* Light blue background */
color: hsl(240, 100%, 20%); /* Dark blue text */
}
While similar, HSL and HSV differ in their lightness/brightness calculations:
HSL has excellent browser support:
/* Progressive enhancement with fallbacks */
.element {
color: #3366CC; /* HEX fallback */
color: rgb(51, 102, 204); /* RGB fallback */
color: hsl(225, 60%, 50%); /* HSL for modern browsers */
}Explore these comprehensive pillar articles related to HSL Color Model
A comprehensive guide to color theory, its fundamental principles, and practical applications in digital design and web development.
Comprehensive guide to complementary colors - opposing hues on the color wheel that create maximum visual contrast, dynamic tension, and powerful design impact through scientific color relationships and perceptual phenomena.
Comprehensive guide to analogous color schemes - adjacent hues on the color wheel that create natural harmony, visual cohesion, and sophisticated design solutions through subtle color relationships and graduated transitions.
A comprehensive guide to tetradic color schemes - sophisticated four-color harmonies that use two complementary pairs arranged in rectangular or square formations on the color wheel, providing maximum color variety while maintaining structured relationships essential for dynamic design compositions, brand systems, and advanced color theory applications.
Discover more about HSL Color Model and related color theory concepts
A comprehensive guide to color theory, its fundamental principles, and practical applications in digital design and web development.
Comprehensive guide to analogous color schemes - adjacent hues on the color wheel that create natural harmony, visual cohesion, and sophisticated design solutions through subtle color relationships and graduated transitions.
Comprehensive guide to complementary colors - opposing hues on the color wheel that create maximum visual contrast, dynamic tension, and powerful design impact through scientific color relationships and perceptual phenomena.
A comprehensive guide to monochromatic color schemes - sophisticated single-hue harmonies that create unified visual experiences through systematic variations in saturation, lightness, and tonal relationships, essential for elegant design compositions, brand consistency, and advanced color theory applications requiring cohesive aesthetic unity.
A comprehensive guide to split-complementary color schemes - sophisticated three-color harmonies that combine a base color with two colors adjacent to its complement, creating balanced visual contrast with reduced tension compared to direct complementary pairs, essential for refined design compositions, brand identity systems, and advanced color theory applications.
A comprehensive guide to tetradic color schemes - sophisticated four-color harmonies that use two complementary pairs arranged in rectangular or square formations on the color wheel, providing maximum color variety while maintaining structured relationships essential for dynamic design compositions, brand systems, and advanced color theory applications.
Discover more color terminology and concepts in our comprehensive glossary.
Browse Full Glossary