0

i know that there are many answers that would perhaps resolve the issue i am having, however, i would love second opinion and possible a clean workaround.

I have simple css color variable in hex/rgba.

--complementary-contrast-alt-1: #4d4d51; (prefered format) or 
--complementary-contrast-alt-1: rgb(78, 78, 81) (alternative format);

So this variable should always be in the same format as it can be replaced from the backend: However, i need to add opacity to it. In a new variable i am implementing:

 --complementary-contrast-1-translucent:  rgba(var(--complementary-contrast-alt-1), 0.9);

The thing is that sadly this wont work unless the main variable is numbers:

 --complementary-contrast-alt-1: 78, 78, 78;

This of coarse raises more issues as the main variable works for my new variable but it does not work for everything else that is also using it.

I am looking for a solution which would not include JS functions. Some sort of work around that would simplify the outcome. Or if there is no way to make it without function, how could that look alike?.

Siouxx
  • 59
  • 5

0 Answers0