This API would allow to get and set the site’s current color palette using Wix Corvid.
The main reason for this request is to be able to make a dark theme option or even other themes for my site. I know there’s already a post on this matter ( https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-dark-mode-switch ) but it has several problems like not being able to change for example the background color of a button when it’s hovered or the fact the 90+ lines of code will slow down the site.
The API would make things much easier . You make your site based on a color palette and then proceed to make another color palette. Then the API let’s you switch between them. I would think it like this:
To the right is a screenshot of the Site Colors . The API basically has access to the Color Palettes . It allows you to get or change the Site Colors to a specific palette you’ve created.
Getting the current palette:
var curPalette = wixColor.getCurrentPalette();
// returns the index of the Color Palette. Starts at 0.
Setting the current palette:
wixColor.setCurrentPalette(1).then(() => {
console.log("Success!");
}).catch((error) => {
console.error(error.message);
});
IMPORTANTE NOTE: When changing the color palette, it creates a new a Cookie which stores the Current Color Palette. It’s not a universal/global thing, it affects only the current computer/user. I hope I made myself clear.
I don’t think this is too complicated, so please add this feature!
Feedback/Suggestions are always welcome.