How can I please change the background color of a desktop application using JavaScript so that the settings are saved after the program is closed? I am using ElectronJS and since it is a desktop application, I cannot use cookies for this purpose.
What I've tried:
const color1Picker = document.getElementById("confirmColors")
color1Picker.onclick = () => {
const color1 = document.getElementById("color1").value;
const color2 = document.getElementById("color2").value;
document.querySelector(":root").style.setProperty('--color1', color1);
}
Here I expected this solution to work only until the user exits the application.
What solution can I think of?
Somehow (probably using NodeJS/Express) save the variables from HTML into a JSON file and then reload them into Vanilla JS using fetch.
But this seems like too clumsy a solution to me.
Can you think of a better way please?