border: 2px solid #A83A23;
The above is a hypothetical application of color, in a real project color code: #A83A23, for example, maybe used 70-100 times across various files such as layout.css, style.css or responsive.css.
Is there a JS way if we can change color code with a quick JS code?
You can do it with custom variables and overriding them via the style tag and/or js.
A quick (jQuery because I’m too busy atm to remember the vanilla syntax) example. Three paragraphs, each setting the color a different way.
What happens when that blue is switched out for yellow. When all the type fails to be seen because once the background was blue and now it’s yellow and you are using light type color. What about the colors of the buttons through the site. What about the specific instances where the the perfect, hue, saturation was balanced now to be destroyed with what seems like a trivial change. Change one thing in a design and it can destroy the whole thing. Even just a color. Color plays a huge role in design.
And when we do this we will be in the realm of sass CSS?
I tried something like this:
border: 2px solid var(--var1);
It doesn’t seem to be working.
It’s working for me? What isn’t working for you?
I was replicating my code for your perusal in codepen, but it worked there. Looks like in local there is some other issue. I will figure it out later, Thanks for your help.
Why don’t you just replace all occurrences of the color you want to change to a
and define the color in one file which is always loaded?
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.