I have an toggle switch with an svg icon which is being added in the css through background image. Is there any way to change the fill of that svg from red to white? Code below
input {
-webkit-appearance: none;
background:white;
border: 1px solid blue;
position:relative;
transition: background 0.3s;
border-radius: 25px;
width: 55px;
height: 32px;
}
input::after {
border-radius: 50%;
background: black;
position:absolute;
top:50%;
content: '';
left: 30%;
transform: translate(-50%, -50%);
transition: left 0.3s;
height: 1.5rem;
width: 1.5rem;
}
input:checked {
background:gray;
border-color:gray;
background-repeat:no-repeat;
background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/18515/heart.svg');
background-size: 15px;
background-position: center left 7px;
}
input:checked::after {
background:white;
left: 70%;
}
<input
type="checkbox"
checked
/>