Monet 0.0.4.1
dotnet add package Monet --version 0.0.4.1
NuGet\Install-Package Monet -Version 0.0.4.1
<PackageReference Include="Monet" Version="0.0.4.1" />
paket add Monet --version 0.0.4.1
#r "nuget: Monet, 0.0.4.1"
// Install Monet as a Cake Addin #addin nuget:?package=Monet&version=0.0.4.1 // Install Monet as a Cake Tool #tool nuget:?package=Monet&version=0.0.4.1
Monet
.NET library for generating Material Color Palettes from an image or a color
Based on https://material-foundation.github.io/material-theme-builder/app.js
Features
Generate a seed primary color from an image (for example the user's wallpaper):
string imageId = "Monet.Samples.Assets.5_wallpaper.webp";
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(imageId)!;
SKBitmap bitmap = SKBitmap.Decode(stream).Resize(new SKImageInfo(112,112), SKFilterQuality.Medium);
uint[] pixels = bitmap.Pixels.Select(p => (uint)p).ToArray();
uint seedColor = Utils.SeedFromImage(pixels);
Use that color to create a CorePalette
that can be used to create any tone of any key color:
CorePalette corePalette = new(seedColor);
Color color = corePalette.Secondary[55].ToColor();
Map the CorePalette
to any
Material Design 3 named color
using Theme
Theme theme = new(corePalette);
Color primaryContainer = theme.PrimaryContainer;
Set Theme.IsDark
to true
to get the dark colors:
theme.IsDark = true;
Color darkTertiary = theme.Tertiary;
Theme
uses the
default Material Design 3 mapping of tokens.
This can be changed by making your own theme:
public class MyTheme : Theme
{
public MyTheme(CorePalette corePalette) : base(corePalette) { }
protected override uint GetBackgroundLight() => Palette.Primary[98];
protected override uint GetSurfaceLight() => Palette.Neutral[100];
protected override uint GetSurfaceDark() => Palette.Neutral[20];
}
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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
0.0.4.1 | 652 | 12/31/2021 | |
0.0.4 | 519 | 12/18/2021 | |
0.0.3 | 508 | 12/13/2021 | |
0.0.2 | 505 | 12/13/2021 | |
0.0.1-alpha | 268 | 12/13/2021 |