You can use variables, but you cannot try separate red, green, and blue components from the same hex value in CSS.
If you want to use variables with rgba() , you will need to specify the variable for each color component as a decimal value and refer to each variable in the rgba() function as follows:
:root { --accent-red: 223; --accent-green: 208; --accent-blue: 165; } h1 { background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(var(--accent-red), var(--accent-green), var(--accent-blue), 1)); }
Alternatively, you can specify the entire rgba() value as one variable, although in this case you will need to include alpha:
:root { --accent-color: rgba(223, 208, 165, 1); } h1 { background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--accent-color)); }
BoltClock Apr 12 '15 at 16:11 2015-04-12 16:11
source share