I want to replace #789034 code to another code like #456780 where ever it finds in main.css using jquery
I am having a main.css file something like below :
You can achieve this functionality by using CSS variables. Define a variable in your main.css file.
:root {
--color1: #789034;
}
and use this variable instead of color code.
.common-color
{
color: var(--color1);
}
Now you can change the color by implementing the following function through passing new color in the parameter.
function ChangeColor1(newColor)
{
document.documentElement.style.setProperty('--color1',newColor);
}