Datatypes › Common › color

RGB color triplet

ID rgbcolor

Pattern of colorNot PIIcategoricalDraft

This record is a draft: it has not been reviewed yet and may be incomplete or wrong. Do not rely on it for compliance decisions. Help improve it (see CONTRIBUTING.md).

Color written as its red, green and blue components: three integers from 0 to 255 separated by commas, either bare (220,220,220) or in the CSS functional notation rgb(220, 220, 220). Design tools, data exports and stylesheets use it; the hexadecimal form of the same color is hexcolor. The regexp does not cover percentages, an alpha channel or the space-separated syntax of CSS Color Level 4.

Pattern of
Color color
Categories
Common
Countries
Global (not tied to a country)
Languages
Common to most languages
AutoType benchmark
rgb
Quality
100/100
Metacrafter rules
1 rule (0 by field name, 1 by value)
Supported by tools
Auto-Type, metacrafter, validator.js

Regular expression

^(?:rgb\(\s*(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\s*,\s*(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\s*,\s*(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\s*\)|(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\s*,\s*(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\s*,\s*(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))$

Python re syntax.

Test a value

Examples

ValueDescription
220,220,220 CSS named color gainsboro
rgb(255, 99, 71) CSS named color tomato
0, 0, 0 Black
256,0,0 invalid A component above 255
#FF6347 invalid Hexadecimal form

Translations

LanguageNameDescription
RussianЦвет RGBЦвет, записанный тремя компонентами (красный, зелёный, синий) от 0 до 255.

Sources

Use this record