docs.rodeo

MDN Web Docs mirror

CSS colors

{{CSSRef}} 

The CSS colors module defines colors, color types, color blending, opacity, and how you can apply these colors and effects to HTML content.

While this module has only two CSS properties, {{cssxref("color")}}  and {{cssxref("opacity")}} , over 20 CSS and SVG properties, CSS images, at-rules, and @media rules depend on these two properties.

Colors in action

The color syntax converter below shows the values of the currently selected color in red-green-blue (RGB), hexadecimal (HEX), hue, saturation, and lightness (HSL), and hue, whiteness, and blackness (HWB) CSS color formats. All the RGB, HEX, HSL, and HWB color values here, while written differently, represent the same color value.

{{EmbedGHLiveSample("css-examples/modules/colors.html", '100%', 450)}} 

Selecting a color via the color picker and an opacity via the slider updates the RGB, HEX, HSL, and HWB values. When you choose a new color or opacity value, the color of the background and the slider update via the CSS properties {{cssxref("background-color")}}  and {{cssxref("accent-color")}} , respectively.

To see the code for this color syntax converter, view the source on GitHub.

Reference

Properties

At-rules and descriptors

Functions

Data types

Glossary terms and keywords

Interfaces

Guides

Specifications

{{Specifications}} 

See also

In this article

View on MDN