RGBBaseline · Widely available
The rgb(), rgba(), and hexadecimal (as in #004488ff) notations pick colors using red, green, blue, and alpha (transparency) channels.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jan 15, 2020. Widely available since Jul 15, 2022.
Browser support
DesktopChrome
1–64Not supported
65+Supportedsince Mar 6, 2018
Current: 155Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154Firefox
1–51Not supported
52+Supportedsince Mar 7, 2017
Current: 157Safari
1–12Not supported
12.1+Supportedsince Mar 25, 2019
Current: 27MobileChrome Android
18–64Not supported
65+Supportedsince Mar 6, 2018
Current: 155Firefox Android
4–51Not supported
52+Supportedsince Mar 7, 2017
Current: 157Safari iOS
1–12Not supported
12.2+Supportedsince Mar 25, 2019
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: rgb.
Feature detection
CSS · check before using
@supports (color: color(display-p3 1 0 0)) {
/* styles that use rgb */
}
/* or in JavaScript */
if (CSS.supports("color", "color(display-p3 1 0 0)")) {
// use it
}Documentation (MDN)
Specification
Sub-features
Support for each part of the feature (7). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| <color>.rgb | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| <color>.rgb.alpha_parameter | 65 | 79 | 52 | 12.1 | 65 | 52 | 12.2 |
| <color>.rgb.float_values | 66 | 79 | 52 | 12.1 | 66 | 52 | 12.2 |
| <color>.rgb.mixed_type_parameters | 122 | 122 | 113 | 18 | 122 | 113 | 18 |
| <color>.rgb.space_separated_parameters | 65 | 79 | 52 | 12.1 | 65 | 52 | 12.2 |
| <color>.rgb_hexadecimal_notation | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| <color>.rgb_hexadecimal_notation.alpha_hexadecimal_notation | 62 | 79 | 49 | 10 | 62 | 49 | 9.3 |