FluentColors.Maui 1.0.0.6

dotnet add package FluentColors.Maui --version 1.0.0.6
                    
NuGet\Install-Package FluentColors.Maui -Version 1.0.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FluentColors.Maui" Version="1.0.0.6">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FluentColors.Maui" Version="1.0.0.6" />
                    
Directory.Packages.props
<PackageReference Include="FluentColors.Maui">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FluentColors.Maui --version 1.0.0.6
                    
#r "nuget: FluentColors.Maui, 1.0.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FluentColors.Maui@1.0.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FluentColors.Maui&version=1.0.0.6
                    
Install as a Cake Addin
#tool nuget:?package=FluentColors.Maui&version=1.0.0.6
                    
Install as a Cake Tool

FluentColors.Maui

NuGet License: MIT

Access colors declared inside .NET MAUI Resources/Colors.xaml 🎨 from code behind, with IntelliSense support.

How It Works

  1. Add the NuGet package to your MAUI project
  2. Source code generator runs - a new file AppColors.cs is created
  3. Use your colors with IntelliSense support from code-behind!

Runs only if Colors.xaml has changed.

Before

label.TextColor = App.Current.Resources["Accent"] as Color; // no IntelliSense, typos possible 

After

label.TextColor = AppColors.Accent; // IntelliSense support, safe and clean

// Bonus: some fluent color extensions!
var colorPrimaryLightest = AppColors.Primary.Lighten(0.3f);

Installation

Install via NuGet Package Manager:

dotnet add package FluentColors.Maui

Or add to your .csproj:

  <PackageReference Include="FluentColors.Maui" Version="1.0.0.5">
    <PrivateAssets>all</PrivateAssets>
    <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  </PackageReference>

Settings

You can additionally manage options by setting these tags inside your .csproj file:

Setting Default Description
ColorResourcesGeneratorEnabled true Enable/disable the generator
ColorResourcesClassName AppColors Name of the generated class
ColorResourcesNamespace $(RootNamespace) Namespace for the generated class
ColorResourcesXamlPath (auto-detected) Optional. By default, looks for Colors.xaml in Resources\ or Resources\Styles\. Set this to specify a custom location. Supports both absolute and project-relative paths.

Custom Colors.xaml Path Example

If your Colors.xaml is in a non-standard location, specify the path in your .csproj:

<PropertyGroup>
  
  <ColorResourcesXamlPath>Themes\AppColors.xaml</ColorResourcesXamlPath>

  
  
</PropertyGroup>

Fluent Extension Methods

The package includes some fluent extension methods for color manipulation:

Opacity & Alpha

// Set opacity as percentage (0-100)
var semiTransparent = AppColors.Primary.WithOpacity(50); // 50% opacity

// Set alpha as float (0.0-1.0)
var transparent = AppColors.Secondary.WithAlpha(0.75f); // 75% alpha

Lighten & Darken

// Create lighter version (default factor: 0.2)
var lighter = AppColors.Primary.Lighten(); // 20% lighter
var muchLighter = AppColors.Primary.Lighten(0.5f); // 50% lighter

// Create darker version (default factor: 0.2)
var darker = AppColors.Primary.Darken(); // 20% darker
var muchDarker = AppColors.Primary.Darken(0.5f); // 50% darker

Hex Conversion

// Convert color to hex string
string hex = AppColors.Primary.ToHex(); // "#3D9BD7"

// Convert with alpha channel
string hexWithAlpha = AppColors.Primary.ToHexWithAlpha(); // "#3D9BD7FF"

Create from Hex

// Create color from hex string (with or without #)
var color1 = ColorExtensions.FromHex("#3D9BD7");
var color2 = ColorExtensions.FromHex("3D9BD7");

// Supports shorthand format
var color3 = ColorExtensions.FromHex("#F00"); // Same as #FF0000

// With alpha channel (AARRGGBB format)
var color4 = ColorExtensions.FromHex("#803D9BD7"); // 50% opacity

// RGBA format (RRGGBBAA)
var color5 = ColorExtensions.FromHexRGBA("#3D9BD780"); // 50% opacity

Troubleshooting

Colors.xaml not found

Issue: Build warning "Colors.xaml not found at: ..." Solution: Ensure Colors.xaml exists at Resources\Colors.xaml or Resources\Styles\Colors.xaml. For other locations, set a custom path using ColorResourcesXamlPath setting in your .csproj file

Generated class not found

Issue: "The type or namespace name 'AppColors' could not be found" Solution:

  1. Build the project (generator runs on build)
  2. Check that Resources/AppColors.cs was created
  3. Verify the namespace matches your RootNamespace

Generated name is different

Issue: "The name in XAML was 'SupaColor-100' and I can't find it."
Solution: Please look for 'SupaColor_100' in code-behind.

IntelliSense not showing colors

Issue: Can't see color properties in autocomplete Solution:

  1. Rebuild the project
  2. Restart Visual Studio / IDE
  3. 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.


Enjoy strongly-typed, fluent color resources! 🎨

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 🎨
Version Downloads Last Updated
1.0.0.6 1,421 11/26/2025
1.0.0.5 448 10/19/2025