Understanding Color Formats: HEX, RGB, RGBA, HSL & HSLA
Modern digital design and web development rely on multiple mathematical representations of light and color. While each format produces identical visual outputs on digital screens (sRGB gamut), each format offers distinct advantages depending on whether you are writing CSS stylesheets, working with graphics software, or scripting dynamic UI animations.
Hexadecimal Notation
Hexadecimal (HEX) represents red, green, and blue light channels using base-16 numbers (0-9 and A-F). Standard 6-digit hex format (e.g., #A398EB) allocates two digits per channel (00 = 0 to FF = 255). An 8-digit variant (#A398EBCC) appends an additional byte for alpha opacity. HEX is compact, widely supported across graphics tools (Figma, Photoshop), and ideal for CSS variables.
Red, Green, Blue & Alpha
RGB uses decimal integers from 0 to 255 for each primary additive light channel: rgb(163, 152, 235). RGBA adds an alpha channel from 0.0 (transparent) to 1.0 (fully opaque), like rgba(163, 152, 235, 0.8). RGB is the native color model for digital displays and canvas rendering contexts.
Hue, Saturation, Lightness & Alpha
HSL maps colors to a cylindrical coordinate model designed to mirror human perception. Hue is an angle (0° to 360°) on the color wheel (0° Red, 120° Green, 240° Blue). Saturation is a percentage (0% neutral gray to 100% vivid pure hue). Lightness represents illumination (0% pitch black, 50% normal color, 100% pure white). HSLA integrates alpha opacity. HSL makes generating consistent design scales and dark-mode themes straightforward.