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

359
Visualizações
How do you change the color of a fixed text based on the background color

Does anyone know a pure css solution to make every part of a fixed svg change color based on the background color (light or dark), just like in this website and their logo. I tried to look at the code, but i don't see anything that can explain this behaviour. Maybe they are using a js solution but i can't imagine how they do it.

I've checked:

  • The fill color of the svg: it doesn't change.
  • Every css value of the svg and the parent: nothing that can explain this behaviour to my knowledge.

Anyone knows how to do this?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Simply speaking, you cannot assign a color property to an element based on its or its parent’s background-color in CSS.

But, you can use mix-blend-mode to apply some color effect that takes into account fore- and background.

This is what they do in your site example.

If you inspect the MENU’s properties, you will notice that the color is the same as the background. But due to mix-blend-mode: difference, it will be calculated black with the same color in the background, or white, if the background is black.

What’s really nice about this is that colour can be calculated differently in the middle of a character. This even works on top of video.

about 4 years ago · Santiago Trujillo 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