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

279
Visualizações
Get Monaco editor background color

I’ve got a Monaco setup where you can select from over 40 themes, the problem is that I want to adapt my website Color’s to Monaco theme ones. How do I get that? I tried using getComputedStyle(document.querySelector(‘.monaco-editor’)). That gets the background color of the editor, but for the theme you had selected before. If you had selected a light theme and now you select a dark theme, the color will output the light theme’s background. What could I do?

SOLVED: The problem was because it was trying to get the colour before the theme was loading. I got it working using promises.

fetch(`/themes/${p}.json`)
  .then(data => data.json())
  .then(data => {
    monaco.editor.defineTheme('theme', data);
    monaco.editor.setTheme('theme');
    $('.sidebar').style.backgroundColor = pSBC(0.1, getComputedStyle($('.monaco-editor')).backgroundColor)
    $('.sidesidebar').style.backgroundColor = pSBC(0.1, getComputedStyle($('.monaco-editor')).backgroundColor)
    $('.skypackbar').style.backgroundColor = pSBC(0.1, getComputedStyle($('.monaco-editor')).backgroundColor)
  })
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The Monaco editor uses CSS variables to define its colors. Check the Monaco Editor Playground: https://microsoft.github.io/monaco-editor/playground.html

enter image description here

Check the Visual Studio Code theme color reference for each color name: https://code.visualstudio.com/api/references/theme-color

Why Visual Studio Code, you may ask. Well, that's because vscode uses Monaco as the central control and that was actually extracted from the vscode code base, to be able to publish it as a standalone tool.

about 4 years ago · Juan Pablo Isaza Relatório
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