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

384
Vistas
OpenLayers Color an SVG Icon

I have been following the Icon Colors example on the OpenLayers site, http://openlayers.org/en/latest/examples/icon-color.html?q=color.

This works well for me with png and jpg images, however when I switch to using svg images the color does not change at all. There are no errors. The color just does not change.

Here is the snippet of code where the color change happens:

    /*set the colour*/
    var style = new ol.style.Style({
        image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
            anchor: [0.5, 0.5],
            src : 'img/icons/example.svg',
            color: '#8959A8'
        }))
    }); 

Any advice would be greatly appreciated!

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Apparently the fill property for your SVG needs to be white (#fff). The doc doesn't say anything about this but my conclusion is that any white (#fff) will be colorized with the value passed to the color attribute, independently of the type of the image.

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