Datatypes › Common › color

RGBA color (rgba() with an alpha channel)

ID rgbacolor

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 in the CSS functional notation rgba(): red, green and blue from 0 to 255 and an opacity (alpha) from 0 (transparent) to 1 (opaque), as rgba(179, 226, 205, 1) or rgba(222,45,38,0.8). Charting libraries such as Plotly and Chart.js and stylesheets write colors with transparency this way, and chart exports keep them in the color fields of traces and markers. The form without alpha is rgbcolor, the hexadecimal one hexcolor. The regexp does not cover percentages 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
Quality
90/100 · missing: mapping (Wikidata, Schema.org, ...)
Metacrafter rules
1 rule (0 by field name, 1 by value)
Supported by tools
metacrafter

Regular expression

^rgba ?\(\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*,\s*(?:0|1|0?\.\d+|1\.0+)\s*\)$

Python re syntax.

Test a value

Examples

ValueDescription
rgba(179,226,205,1)
rgba(222, 45, 38, 0.8)
rgba(0,0,0,0) fully transparent
rgba (255, 0, 0, 1) with a space after rgba, as older Plotly figures write it
rgba(256,0,0,1) invalid A component above 255
rgb(255, 99, 71) invalid Without alpha (rgbcolor)

Translations

LanguageNameDescription
RussianЦвет RGBA (rgba() с альфа-каналом)

Sources

Use this record