Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

254
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda