I am designing an app in electron, so I have access to CSS variables. I have defined a color variable in vars.css
:
:root {
--color: #f0f0f0;
}
I want to use this color in main.css
, but with some opacity applied:
#element {
background: (somehow use var(--color) at some opacity);
}
How would I go about doing this? I am not using any preprocessor, only CSS. I would prefer an all-CSS answer, but I will accept JavaScript/jQuery.
I cannot use opacity
because I am using a background image that should not be transparent.