I am working on a feature where users can personalize the theme by selecting their own colors from a dropdown menu. My task as a developer is to apply different shades based on the chosen color.
For example, if the user chooses Green, I would use solid Green for the primary header, Green with 60% opacity for table headers, and Green with 50% opacity for active/selected table rows.
I have attempted the following approach, but passing a variable to RGBA does not seem to impact the background color:
CSS
:root {
--color: #008000;
--alpha: 0.5;
}
#primary-header{
background-color: rgba(var(--color));
}
#table-header{
background-color: rgba(var(--color), var(--alpha));
}