Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tmk907/PaletteNet
.NET port of Android's Palette. Extract prominent colors from an image
https://github.com/tmk907/PaletteNet
color-palette colors image palette winui3
Last synced: 3 days ago
JSON representation
.NET port of Android's Palette. Extract prominent colors from an image
- Host: GitHub
- URL: https://github.com/tmk907/PaletteNet
- Owner: tmk907
- License: apache-2.0
- Created: 2017-11-20T15:49:40.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-01-05T10:18:54.000Z (10 months ago)
- Last Synced: 2024-04-27T09:20:18.371Z (6 months ago)
- Topics: color-palette, colors, image, palette, winui3
- Language: C#
- Homepage: https://www.nuget.org/packages/PaletteNet/
- Size: 3.28 MB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- WinUI-3-Apps-List - PaletteNet
README
# PaletteNet
Library to extract prominent colors from an image.
- Dominant
- Vibrant
- Vibrant Dark
- Vibrant Light
- Muted
- Muted Dark
- Muted Light.NET port of Android's Palette https://developer.android.com/reference/android/support/v7/graphics/Palette.html
## Install
[![Nuget](https://img.shields.io/nuget/v/PaletteNet)](https://www.nuget.org/packages/PaletteNet) [https://www.nuget.org/packages/PaletteNet](https://www.nuget.org/packages/PaletteNet)
Target frameworks:
- net6.0
- net6.0-android
- net6.0-windows10.0.19041.0
- netstandard2.0
- net48## Example (WinUI3)
```c#
using IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.Read);
BitmapDecoder decoder = await BitmapDecoder.CreateAsync(fileStream);PaletteColors palette = PaletteColors.Generate(new BitmapDecoderHelper(decoder));
Color dominantColor = palette.DominantColor;
IEnumerable allColors = palette.GetAllColors();
```
or
```c#
IBitmapHelper bitmapHelper = new BitmapDecoderHelper(decoder);
PaletteBuilder paletteBuilder = new PaletteBuilder();
Palette palette = paletteBuilder.Generate(bitmapHelper);
int? rgbColor = palette.MutedColor;
int? rgbTextColor = palette.DominantSwatch.TitleTextColor;
```![screenshot 1](https://github.com/tmk907/PaletteNet/blob/master/images/example1.png "Example 1")
![screenshot 2](https://github.com/tmk907/PaletteNet/blob/master/images/example2.png "Example 2")## Sample app
Download app from Microsoft Store
[Color palette icons created by Freepik - Flaticon](https://www.flaticon.com/free-icons/color-palette)