0

I use svg-icons in an app and the question is if it is necessary to put icons in different colors there or if I can set a color by code. Here is my approach:

app.scss:
ion-icon {
  &[class*="custom-"] {
    mask-size: contain;
    mask-position: 50% 50%;
    mask-repeat: no-repeat;
    background: currentColor;
    width: 1em;
    height: 1em;
  }

  &[class*="custom-mobile"] {
    background: url(../assets/mobile.svg);
  }


}

view:

<ion-item>
      <ion-icon name="custom-mobile"></ion-icon>
</ion-item>

I change the color of background in the class-part but no effect on view.

Micha
  • 906
  • 6
  • 9

0 Answers0