concept
relative-color-syntax — CSS reference
Relative syntax starts from an existing color, converts it into the destination function’s space, and exposes channels for reuse or arithmetic. RGB channel references use numeric 0–255 scaling; alpha uses a 0–1 number. Different functions expose different channel names and scales. A normal absolute color declaration provides a fallback.
Formal Syntax & Structure
css syntaxcss
rgb(from <color> R G B [ / alpha ]) (example form)Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS color lab</title><style>body {margin:0} .sample {height:12px;background:#006050}p {padding:12px;background:white;color:black;border:2px solid currentColor} #a{color:rgb(from red r 100 b / 0.5)} #b{color:rgb(from blue r g b)}
</style><body><p id="a">First color sample</p><p id="b">Second color sample</p></body></html>