RGB: Red Green Blue Additive CSS Color
Additive channel model mixing Red, Green, and Blue primaries from 0 to 255 or 0% to 100%, with modern space-separated CSS Color 4 syntax.
| Extension / Token | .css / .json |
|---|---|
| MIME / Media type | text/css |
| Gamut scope | sRGB (Standard Web) |
| Human readability | Medium |
| Perceptual uniformity | No |
| Alpha channel support | Yes |
| Best for | Pixel buffers, Canvas 2D shaders, and programmatic alpha opacity blending |
RGB
CSS / .JSONrgb(37 99 235 / 0.85)Strengths
- Maps 1:1 to browser Canvas 2D Uint8ClampedArray pixels and display subpixels.
- Modern CSS Color 4 merges rgb() and rgba() into space-separated slash syntax.
- Easy numeric channel clamping (0–255 or floating 0–1).
Trade-offs
- Linear interpolation inside gamma sRGB desaturates complementary gradients through gray.
- Hard to predict perceptual lightness or WCAG contrast from raw R/G/B integers.
Convert & inspect RGB locally
Related color engineering guides
- WCAG 2.2 Contrast Ratio vs APCA (Lc): Complete Color GuideCompare WCAG 2.2 relative luminance ratios (4.5:1) against modern APCA perceptual lightness contrast (Lc 60/75/90), dark-mode polarity, and CVD.
- Recoloring SVGs & Generating Exact Dark-Mode CSS FiltersBatch-recolor multi-path SVG icons without broken strokes, or compute exact brightness/sepia/hue-rotate CSS filters for img tags in dark mode.
- Convert CSS hex alpha to Android ARGBMove the alpha byte from the end of a CSS hex color to the front of an Android color resource. Check the result with a translucent blue test swatch.
RGB frequently asked questions
Is rgba() deprecated in modern CSS?
rgb() and rgba() are now aliases in CSS Color 4 — prefer space-separated rgb(37 99 235 / 50%) for clean modern stylesheets.
Why convert RGB to linear RGB or OKLab before blending?
Gamma-encoded sRGB bends light curves non-linearly; converting through linear light or OKLab eliminates muddy dark bands.