Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
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?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda