简体   繁体   中英

How to create icons similar to Segoe MDL2 Assets in UWP

as I said, Segoe MDL2 Assets has many icons, but not enough. Usually we want to use our own icons.

But there is one problem, our own icons can't auto suite for both light and dark themes, while the segoe icons can.

So, anybody know how? Thanks :)

在此处输入图片说明

在此处输入图片说明

I may be wrong, but if you use your own custom font - the icons should get appropriate colors (assuming that your font isn't already colored). If you just use a Path element - you'd probably need to specify a ThemeResource for its Foreground and define theme specific resources (or just use one that the platform provides).

If you want the icon font to be of the right color you'll have to export as a font (ie ttf ) and not as ico

There are few online tools to convert your PNG assets to a font file

Once you have a font file you can use it in your app, specifying the font family in XAML

<TextBlock Text="&#xEB52; FontFamily="/Assets/Fonts/my-font.ttf#My Font"/>

You can also create a new FontFamily if you don't want to specify the path each time https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.fontfamily

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