html
<img src="logo.svg" alt="Logo" class="logo-img">
css
.logo-img path {
fill: #000;
}
El svg anterior se carga y es nativamente fill: #fff
pero cuando uso el anterior css
para intentar cambiarlo a negro no cambia, esta es mi primera vez jugando con SVG y no estoy seguro de por qué no funciona.
Si su objetivo es sólo para cambiar el color del logotipo, y usted don't necesariamente necesita usar CSS, entonces don't uso de javascript o jquery como fue sugerido por algunas respuestas anteriores.
Para responder con precisión la pregunta original, sólo:
Abra su logo.svg
en un editor de texto.
Busque relleno: #fff
y sustitúyalo por relleno: #000
Por ejemplo, su logo.svg
puede tener este aspecto cuando se abre en un editor de texto:
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" fill="#fff"/>
</svg>
... sólo hay que cambiar el relleno y guardar.
La respuesta de @Praveen es sólida.
No pude conseguir que respondiera en mi trabajo, así que hice una función jquery hover para ello.
CSS
.svg path {
transition:0.3s all !important;
}
JS / JQuery
// code from above wrapped into a function
replaceSVG();
// hover function
// hover over an element, and find the SVG that you want to change
$('.element').hover(function() {
var el = $(this);
var svg = el.find('svg path');
svg.attr('fill', '#CCC');
}, function() {
var el = $(this);
var svg = el.find('svg path');
svg.attr('fill', '#3A3A3A');
});