FluentIcons
repository·master·Indexed 42 days ago
https://github.com/davidxuang/fluenticonsA multi-framework .NET library providing Microsoft's Fluent UI System Icons for Avalonia, MAUI, WinUI, WPF, and WinForms. It includes <FluentIcon> and <SymbolIcon> XAML elements, support for various icon variants (Regular, Filled, Color), and an experimental Outline feature. The library is distributed via NuGet and includes the Seagull Icons set, which supports the COLR/CPAL format for color icons.
What's inside FluentIcons
- FluentIcons is a multi-framework control library providing access to fluentui-system-icons. It is distributed via NuGet packages tailored for different .NET platforms and UI frameworks. You can browse the available icons in the online gallery.
Overview of Seagull Fluent Icons
masterSeagull Icons is a modified icon set derived fromfluentui-system-icons. It is designed to provide an appearance similar toSegoe MDL2 AssetsandSegoe Fluent Icons. A key technical feature is its support for the COLR/CPAL format, which ensures that color icons are displayed correctly in supported environments.Compare Fluent vs Symbol icon variants
masterThe library offers two distinct visual approaches:
- Fluent variant: Provides upstream icon sizes untouched (12, 16, 20, 24, 28, 32, 48). The 20x20 size is the standard upstream size.
- Symbol variant: Mimics the appearance and geometric metrics of
SymbolIconand Segoe Fluent Icons from WinUI. It features trimmed borders and rearranged shapes to match Segoe metrics. It is primarily available in 16x16 (Segoe-like) and 28x28 (light) sizes.
Configure Git for building with symbolic links
masterIf you are cloning and building this project using Git for Windows, you must enable symbolic link support to ensure the build succeeds.
git config --global core.symlinks truePlatform-specific implementation notes
masterMAUI
- Setup: You MUST call
UseFluentIcons(this MauiAppBuilder builder)at startup to register fonts. - Icon Sources: Uses
<SymbolImageSource>andSymbolImageSourceExtension. - Colors: All
Brushproperties are defined asColortypes with aColorsuffix.
UWP / WinUI
- Uses the Win2D package for the
Outlinefeature. It is recommended to override the library's Win2D reference with the latest version of the package for better stability.
WinForms
- Rendering: Supports GDI and GDI+ (for Windows 8+).
- Limitations:
- On GDI-supported platforms, the alpha channel of
ForeColoris ignored. - Color icons are not supported on WinForms.
- On GDI-supported platforms, the alpha channel of
WPF
- Limitations: Color icons are currently broken on WPF due to lack of [COLR] rendering support. This also affects environments using SkiaSharp 2 (like macOS or WebAssembly/Avalonia/Uno).
- Setup: You MUST call
Use FluentIcon and SymbolIcon in XAML
masterThe library provides
<FluentIcon>and<SymbolIcon>elements for XAML-based platforms (WinUI, Avalonia, MAUI, WPF).<FluentIcon>uses theIconproperty and supportsIconSize.<SymbolIcon>uses theSymbolproperty and mimics Segoe Fluent Icons behavior.
Common properties available on these elements (and their corresponding
Sourceversions) include:Icon/Symbol: The specific icon identifier.IconVariant: The visual style (e.g.,Regular,Filled,Color).IconSize: (ForFluentIcononly) The size of the icon.FlowDirection: Controls LTR/RTL orientation.FontSize: Adoublevalue for sizing.Foreground: ABrushfor coloring the icon.
<Page xmlns:ic="using:FluentIcons.WinUI"> <!-- Using FluentIcon --> <ic:FluentIcon Icon="ArrowLeft" IconVariant="Regular" IconSize="Size32" /> <!-- Using SymbolIcon --> <ic:SymbolIcon Symbol="Calendar" IconVariant="Color" /> </Page>Select the appropriate FluentIcons package for your platform
masterChoose a package based on your target framework and version requirements. The library provides specific packages for Avalonia, MAUI, UWP, WinForms, WinUI, and WPF.
Available Packages by Platform
Package Platform FluentIcons.AvaloniaAvalonia 12 FluentIcons.Avalonia.FluentFluentAvalonia 3 (Avalonia 12) FluentIcons.MauiMAUI 10 FluentIcons.UwpUWP 10.0.10773 or Uno.UI 5.4 FluentIcons.WinForms.NET Framework 4.5 or .NET 6 FluentIcons.WinUIWindows App SDK 1.8.5 or Uno.WinUI 6.0 FluentIcons.Wpf.NET Framework 4.5 or .NET 6 FluentIcons.CommonMeta package FluentIcons.Common.ExtensionsMeta package Add and configure shared assets in WinUI
masterTo use shared assets (like images) in a WinUI project, follow these steps:
- Add the image file to the
Assetsdirectory of your shared project. - Set the file's Build Action to
Contentin your project properties. - (Recommended) Provide multiple versions of the asset for different scales/DPIs to ensure high-quality rendering across devices.
1. Add the image file to the `Assets` directory of a shared project. 2. Set the build action to `Content`.- Add the image file to the
Asset naming conventions for different scales
masterWhen providing assets for various scales, you can use two different directory structures.
Option 1: Suffix naming (WinUI style) Use the
.scale-Nsuffix directly on the filename:\Assets\Images\logo.scale-100.png \Assets\Images\logo.scale-200.png \Assets\Images\logo.scale-400.pngOption 2: Subdirectory naming Place images in scale-specific subdirectories:
\Assets\Images\scale-100\logo.png \Assets\Images\scale-200\logo.png \Assets\Images\scale-400\logo.png\Assets\Images\logo.scale-100.png \Assets\Images\logo.scale-200.png \Assets\Images\logo.scale-400.png \Assets\Images\scale-100\logo.png \Assets\Images\scale-200\logo.png \Assets\Images\scale-400\logo.pngDefine Gradients and Filters in Defs
masterAdvanced visual effects like gradients and filters must be defined within a
Defscontainer (the<defs>tag). These definitions are then referenced by ID in other elements.export type Defs = ElemBase & { '#name': 'defs'; $$?: Def[]; }; export type Def = LinearGradient | RadialGradient | ClipPath | Filter;Understand the transform configuration schema
masterThe
transformprocess relies on a TOML configuration file that defines how icons are redirected, how they are base-translated, and how they are composed with badges.Configuration Sections
redirect: Maps icon names to new paths or categories. Can be a simple string or an object mapping categories to paths.base: Defines metadata for base icons, including translation offsets (u,v,ul,vl) and RTL flipping (vflip).template: DefinesBadgeTemplateobjects used as blueprints for badge composition.compose: Defines how badges are composed with icons. It uses a descriptor syntax to resolve icon names and styles.
Descriptor Syntax
Icon descriptors in the
composesection follow this pattern:icon:root[modifier]#/override@lang:langWhere:
icon: The base icon name.:root: The root/alias.[modifier]: An optional modifier.#/override: An optional override path.@lang:lang: Optional language specification (source and destination).
Use FluentIcons Markup Extensions
masterSince version 1.3, markup extensions are located in a child namespace. You can use them to provide icons directly within other control properties (like an
Expanderheader) using the{icx:SymbolIcon}syntax.<Page xmlns:icx="using:FluentIcons.WinUI.Markup"> <Expander Header="{icx:SymbolIcon Symbol=ArrowLeft}" /> </Page>