I was doing a simple project of background themes and everything is working as expected, but the code in the javascript was very repetitive since the complete project has 9 colors.
I’d like to know if there’s a better way to do it without getting a lot of extensive code (in short, the extensive code in my point of view is a very polluted code). I want to know how much I can improve using only javascript without a js framework or js library, if not, I would also like to hear about a best practice to avoid repeating the same function several times
You can see an example of the project https://codepen.io/Leonardo-Lopes-Honda/pen/LYgWrNN