Beyond simple names, CSS provides sophisticated ways to define and manipulate color. TL;DR: Use HEX for standard palette definitions, RGBA for non-destructive alpha transparency, and HSL for programmatic dynamic theming.
1Understanding Models
Web colors are typically defined by mixing light. In the RGB model, you specify the intensity of Red, Green, and Blue. In the HSL model, you define a 'Hue' (the actual color), 'Saturation' (how vibrant it is), and 'Lightness' (how close to white or black it is). HSL is often preferred by designers because it feels more intuitive to 'brighten' or 'dull' a color by changing a single percentage.
2The Power of Alpha
The 'Alpha' channel is what allows for transparency. When using rgba() or hsla(), the fourth value defines the opacity of that specific color. This is fundamentally different from the opacity property, which makes the entire element (including its text and child elements) transparent. Using alpha channels is the key to creating modern 'glassmorphism' effects.
