I am currently working on an Angular project where I am utilizing SVG to display some icons. These icons originally have a default grey color, but I want them to change to white when hovered over. Interestingly, while changing the color to red, green, or yellow works perfectly fine, attempting to change it to white does not seem to work.
Below is my HTML code snippet:
<div class="user-name">
<svg *ngIf="hasCopyToClipboard" width="10" height="12" viewBox="0 0 10 12"
fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity="0.5"
d="M6.49997 0.500031H0.999995C0.449998 0.500031 0 0.950028 0 1.50003V7.99999C0 8.27499 0.224999 8.49999 0.499997 8.49999C0.774996 8.49999 0.999995 8.27499 0.999995 7.99999V2.00002C0.999995 1.72502 1.22499 1.50003 1.49999 1.50003H6.49997C6.77497 1.50003 6.99996 1.27503 6.99996 1.00003C6.99996 0.725029 6.77497 0.500031 6.49997 0.500031ZM6.79497 2.79502L9.20995 5.21001C9.39495 5.39501 9.49995 5.65 9.49995 5.915V10.5C9.49995 11.05 9.04995 11.5...
And here is how my SCSS looks like:
.user-name {
width: 100%;
font-weight: 500;
font-size: 12px;
padding-left: 3px;
svg {
float: right;
margin: 2px 0 2px 10px;
cursor: pointer;
:hover {
fill: white;
}
}
}