简体   繁体   中英

ionic2: Custom SVG Icons

I'm using Ionic2 I want to use my icons as I use Ionic Icons I've seen this link: custom ionic icons

but I Can't Follow the instruction and I can't understand what is the SVG icons, I don't want to make Icons I have Icons as images and I want to use It, can anyone help me!

You just need to change .svg to .png . Add this to your app.scss file

ion-icon {
    &[class*="appname-"] { 
        mask-size: contain;
        mask-position: 50% 50%;
        mask-repeat: no-repeat;
        background: currentColor;
        width: 1em;
        height: 1em;
    } 
    &[class*="appname-customicon1"] {
        mask-image: url(../assets/img/customicon1.png);
    } 
}

Uses

<ion-icon name="appname-customicon1"></ion-icon>

Credit: adjwilli .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM