Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

257
Views
ElectronJS: Change CSS style via Javascript and save it

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.

Application example

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?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!