Home / Blog / Color & design

Color values & contrast

000 Hex Color

Inspect #000000 as RGB(0, 0, 0), see a working CSS example, and verify contrast and opacity before using the color.

000 Hex Color

#000 represents the sRGB color #000000. In three-digit notation each digit is repeated, so the short form expands channel by channel.

Exact values for this swatch

RepresentationValue
Six-digit hex#000000
RGB channelsrgb(0 0 0)
Approximate HSLhsl(0.0 0.0% 0.0%)

The red pair is 00, the green pair is 00, and the blue pair is 00. Interpreting each pair in base sixteen gives 0, 0 and 0 respectively. The channels are integers from zero to 255. This color can also be written as #000 because both digits in each channel pair match.

Use the value in a real CSS example

.sample {
  background-color: #000000;
  color: #FFFFFF;
  border: 2px solid currentColor;
  padding: 1rem;
}

Apply this class to an element containing actual sample text and inspect it in the browser. The background and foreground are specified separately. A valid color value does not automatically style every part of a component: links, borders, icons, disabled controls and hover states may use other rules. Inspect the computed style if the displayed color differs from the value you entered.

Check this color against its background

Using the WCAG sRGB relative-luminance formula, this opaque swatch has approximately 1.00:1 contrast against black and 21.00:1 against white. The example chooses #FFFFFF text, giving approximately 21.00:1. These figures compare two flat, opaque colors. They do not automatically describe text placed over a photograph, gradient or translucent overlay.

For ordinary text, WCAG’s minimum contrast criterion uses 4.5:1; qualifying large text uses 3:1. Check the applicable text size and weight, and test the actual foreground/background pair with Color Contrast Checker. Do not round a value below the threshold upward to declare a pass. A passing ratio addresses one criterion and does not establish complete accessibility or legal compliance for a page.

The computed relative luminance for this sample is approximately 0.00000 on the normalized zero-to-one scale. That value comes from linearizing the sRGB channels and weighting them, not from averaging 0, 0 and 0. If you adjust this swatch, recalculate the resulting pair rather than assuming that equal numeric changes in different channels have equal effects on contrast.

Keep opacity and channel order explicit

A six-digit hex code has no separate alpha channel and represents an opaque sRGB color. In CSS, an eight-digit hex color uses the order red, green, blue, alpha. Other environments can use alpha first, so copying an eight-digit value between platforms without checking its convention can change both color and opacity. Test a partially transparent sample over at least two different backgrounds to reveal accidental alpha mistakes.

Case does not change a hexadecimal color: uppercase and lowercase digits encode the same values. Leading zeros do matter, however. Keep exactly the required number of digits, and include the leading hash where the receiving format expects CSS notation. A field asking for an RGB triple may want decimal channel values instead of a hash-prefixed string; consult the field’s actual format rather than repeatedly pasting an incompatible value.

Verify the saved color and its limits

Enter the hex value in Hex to RGB, compare its three decimal channels with the table, and then convert the channels back to hex. That round trip should reproduce the same six-digit value. When the display uses rounded HSL values, a small round-trip channel difference can result from rounding, so retain hex or integer RGB as the exact reference for this sample.

A screen swatch is not a print, paint or textile match. Device calibration, color profiles, surrounding colors and lighting affect appearance. CMYK output requires a printing condition and color-management workflow; a named physical product requires its own verified specification or sample. Do not label a convenient on-screen approximation as an official brand formula. Keep the original numeric value, color space and intended role with the design so later edits remain traceable.

Primary references

CSS hexadecimal color notation and WCAG contrast minimum explanation.