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

242
Vistas
Have different color on element based on background element

i am trying to archieve this result: enter image description here

where the red background is a tilting svg based on mousemovement so the coloring has to be able to adjust and not be static.

current and obviously not satisfying result:

enter image description here

Do you guys know of any way on how to archive this?

Any help is very much appreciated. Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

So i looked deeper into mix-blend-mode and got it to work with the following code:

html

<!-- absolute helper is needed as position:absolute on underline elements themselves lead to underlines not breaking correctly -->
<span class="absolute-helper">
    <!-- is used for mix-blend-mode: difference -->
    <span class="underline underline--primary">Text</span>
</span>
<!-- on top of mix-blend-mode: difference there is another layer with underlin that has mix-blend-mode: screen (opposite of multiply) -->
<span class="absolute-helper">
    <span class="underline underline--secondary">Text</span>
</span>

styles

.absolute-helper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.underline {
  background-size: 1px 1em;
  display: inline;
  color: transparent; // hide font and just show the underlining

  &--primary {
    mix-blend-mode: difference; // shows the difference between the current and the underlying layer
    box-shadow: inset 0 -0.175em $white, inset 0 -0.2em #000; // the underline, color has to be white for this to work
  }

  &--secondary {
    mix-blend-mode: screen; // opposite of multiply
    box-shadow: inset 0 -0.175em #somecolor, inset 0 -0.2em #000; // the second underline layered on top
  }
}

result:

result

Maybe someone will find this useful.

Thanks for the help!

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