The following CSS results in the parser stripping the value.
:root {
--my-color: 255, 0, 0;
}
body {
color: rgb(var(--my-color));
}
It seems that the parser thinks the value is invalid since rgb expects three arguments and is only receiving one. However, the CSS works correctly in every major browser.
The reason I am using this syntax is because I'm passing the --my-color variable to various rgba functions throughout the style sheet, and while the color might change, the alpha value of each rgba function is defined separately. I.e., I can't set --my-color to rgba(255, 0, 0, .5) as I'd require hundreds of variables for each opacity.
The following CSS results in the parser stripping the value.
It seems that the parser thinks the value is invalid since
rgbexpects three arguments and is only receiving one. However, the CSS works correctly in every major browser.The reason I am using this syntax is because I'm passing the
--my-colorvariable to variousrgbafunctions throughout the style sheet, and while the color might change, the alpha value of eachrgbafunction is defined separately. I.e., I can't set--my-colortorgba(255, 0, 0, .5)as I'd require hundreds of variables for each opacity.