FluentColors.Maui
1.0.0.5
See the version list below for details.
dotnet add package FluentColors.Maui --version 1.0.0.5
NuGet\Install-Package FluentColors.Maui -Version 1.0.0.5
<PackageReference Include="FluentColors.Maui" Version="1.0.0.5"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="FluentColors.Maui" Version="1.0.0.5" />
<PackageReference Include="FluentColors.Maui"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add FluentColors.Maui --version 1.0.0.5
#r "nuget: FluentColors.Maui, 1.0.0.5"
#:package FluentColors.Maui@1.0.0.5
#addin nuget:?package=FluentColors.Maui&version=1.0.0.5
#tool nuget:?package=FluentColors.Maui&version=1.0.0.5
FluentColors.Maui
Fluent, strongly-typed color resources for .NET MAUI! 🎨
Access colors declared inside MAUI Colors.xaml from code behind, with IntelliSense support, compile-time safety, and additional extension methods as a bonus.
How It Works
- Add the NuGet package to your MAUI project
- Build your project - the generator runs automatically
- Use your colors with IntelliSense support from code-behind!
The generator finds Resources/Colors.xaml, parses all color definitions, and creates Resources/AppColors.cs with strongly-typed properties + fluent extensions!
Before
label.TextColor = App.Current.Resources["ColorAccent"] as Color; // No IntelliSense, runtime errors
After
label.TextColor = AppColors.ColorAccent;
// Bonus: some extensions!
var colorAccentLigther = AppColors.Primary.Lighten(0.3f);
Customization project tags provided to change auto-generated class name etc.
Installation
Install via NuGet Package Manager:
dotnet add package FluentColors.Maui
Or add to your .csproj:
<PackageReference Include="FluentColors.Maui" Version="2.0.0" />
Available Settings
| Setting | Default | Description |
|---|---|---|
ColorResourcesGeneratorEnabled |
true |
Enable/disable the generator |
ColorResourcesClassName |
AppColors |
Name of the generated class |
ColorResourcesNamespace |
$(RootNamespace) |
Namespace for the generated class |
Smart Incremental Build
The generator is smart about regeneration:
- ✅ Only runs if Colors.xaml changed - Won't trigger hot reload unnecessarily
- ✅ Compares content, not timestamps - Ignores timestamp-only changes
- ✅ Fast builds - Skips generation when nothing changed
You'll see:
✓ Successfully generated AppColors.cs- File was regenerated⚡ AppColors.cs is up-to-date, skipping generation- Nothing changed
Requirements
- .NET MAUI 7.0+
Resources/Colors.xamlfile in standard MAUI format
Color Categories
Colors are automatically grouped into regions:
- Standard Colors: Basic MAUI colors (Primary, Secondary, Tertiary, Black, White)
- Gray Scale Colors: Colors starting with "Gray" (Gray100, Gray200, etc.)
- Accent Colors: Colors containing "Accent" (Blue100Accent, Yellow200Accent, etc.)
- Custom Colors: All other colors (ColorAccent, ColorSuccess, etc.)
Troubleshooting
Colors.xaml not found
Issue: Build warning "Colors.xaml not found at: ..."
Solution: Ensure Resources/Colors.xaml exists in your project
Generated class not found
Issue: "The type or namespace name 'AppColors' could not be found" Solution:
- Build the project (generator runs on build)
- Check that
Resources/AppColors.cswas created - Verify the namespace matches your
RootNamespace
IntelliSense not showing colors
Issue: Can't see color properties in autocomplete Solution:
- Rebuild the project
- Restart Visual Studio / IDE
- Check the generated file exists
Build errors after removing colors
Issue: Compilation errors for removed colors Solution: This is expected! The generator provides compile-time safety. Update your code to remove references to deleted colors.
Contributing
Issues and pull requests welcome! Visit our GitHub repository.
License
MIT License - see LICENSE file for details.
Credits
Created by Nick Kovalsky aka AppoMobi for the MAUI community.
Enjoy strongly-typed, fluent color resources! 🎨
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on FluentColors.Maui:
| Repository | Stars |
|---|---|
|
DrawnUi/DrawnUi.Net
Rendering engine for .NET MAUI, Blazor, OpenTK and pure .NET powered by SkiaSharp 🎨
|