<?xml version="1.0" encoding="utf-8"?>

HEX triplet

HEX triplet

Hex triplets are one way to represent RGB colors and are commonly used to specify colors in CSS. Hex colors are prefixed with a “#” and typically include 6 hexadecimal digits (numbers 0–9 and letters A–F).[1] Each pair of digits in the code represents the intensity of the colors red, green, and blue (RGB).

The format is #RRGGBB:

  • RR: Red component (00 to FF)
  • GG: Green component (00 to FF)
  • BB: Blue component (00 to FF)

Here are some examples of hex color codes:

  • Black: #000000
  • White: #FFFFFF
  • Red: #FF0000
  • Green: #00FF00
  • Blue: #0000FF
  • Yellow: #FFFF00

In some cases, they may include a fourth pair of digits, which represent the color’s opacity or alpha. Sometimes, you may see 3-digit hex colors, with only one digit representing each RGB value.

Top contributors

Adam Haesler
Ngo Ngoc Tram
Veronika Nedashkovskaya

Topics

Share

Improve your UX & Product skills with interactive courses that actually work