BlyZe.UniColor 1.0.0

dotnet add package BlyZe.UniColor --version 1.0.0
NuGet\Install-Package BlyZe.UniColor -Version 1.0.0
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="BlyZe.UniColor" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BlyZe.UniColor --version 1.0.0
#r "nuget: BlyZe.UniColor, 1.0.0"
#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.
// Install BlyZe.UniColor as a Cake Addin
#addin nuget:?package=BlyZe.UniColor&version=1.0.0

// Install BlyZe.UniColor as a Cake Tool
#tool nuget:?package=BlyZe.UniColor&version=1.0.0

UniColor

A platform-independent color system that supports Json Serialization

How to use

Ways to initialize a new UniColor instance

var color = new UniColor(200, 100, 25, 255);
var colorFraction = new UniColor(0.34, 0.78, 1, 1);

var fromHex = UniColor.FromHex("#ABCDEF", HexType.RRGGBB);

var fromRgb = UniColor.FromRgb(69, 200, 33);
var fromRgba = UniColor.FromRgba(0.2, 0.5, 1, 1);
var fromArgb = UniColor.FromArgb(-123456);

var fromYCbCr = UniColor.FromYCbCr(2.65, 22.6, 43.7);
var fromHsl = UniColor.FromHsl(180, 1.4445, 1.69);

var random = UniColor.GetRandom(true);

Get information about the color

float brightness = color.GetBrightness();
float saturation = color.GetSaturation();
float hue = color.GetHue();

var (r, g, b) = color.GetRgb();
var (r, g, b, a) = color.GetRgba();
var (r, g, b) = color.GetRgbFractions();
var (r, g, b, a) = color.GetRgbaFractions();

byte r = color.R;
byte g = color.G;
byte b = color.B;
byte a = color.A;
bool isEmpty = color.IsEmpty;

Convert the color to other systems

int rgb = color.ToRgb();
int rgba = color.ToRgba();
int argb = color.ToArgb();

string hex = color.ToHex(HexType.RRGGBBAA);

var (h, s, l) = color.ToHsl();
var (y, cb, cr) = color.ToYCbCr();

string colorString = color.ToString();

Work with the colors

var addedColor = color + anotherColor;
var subtractedColor = color - anotherColor;

var areEqual = color == anotherColor;
var anotherAreEqual = color.Equals(anotherColor);

var invertedColor = color.Invert(true);

There are useful extensions for the UniColor struct

System.Drawing.Color systemColor = color.ToSystem();
System.ConsoleColor nearestCC = color.ToNearestConsoleColor();
UniColor uniColor = System.Drawing.Color.LightBlue.ToUniColor();

Xamarin.Forms.Color xamarinColor = color.ToXamarin();
UniColor uniColor = Xamarin.Forms.Color.DodgerBlue.ToUniColor();

Microsoft.Maui.Graphics.Color mauiColor = color.ToMaui();
UniColor uniColor = new Microsoft.Maui.Graphics.Color(10, 20, 30, 50).ToUniColor();

SixLabors.ImageSharp.Color sharpColor = color.ToSharp();
UniColor uniColor = SixLabors.ImageSharp.Color.DodgerBlue.ToUniColor();

SkiaSharp.SKColor skColor = color.ToSkia();
SkiaSharp.SKColorF skColorF = color.ToSkiaF();
UniColor uniColor = new SkiaSharp.SKColor(10, 20, 30, 50).ToUniColor();
UniColor uniColor = new SkiaSharp.SKColorF(0.1f, 0.2f, 0.3f, 0.5f).ToUniColor();

Android.Graphics.Color androidColor = color.ToAndroid();
UniColor uniColor = Android.Graphics.Color.DodgerBlue.ToUniColor();
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on BlyZe.UniColor:

Package Downloads
BlyZe.UniColor.Extensions.MAUI

An extension for UniColor to work with the Microsoft.Maui.Graphics namespace

BlyZe.UniColor.Extensions.System

An extension for UniColor to work with the System and System.Drawing namescpace

BlyZe.UniColor.Extensions.Android

An extension for UniColor to work with the Android.Graphics namespace

BlyZe.UniColor.Extensions

Extensions for UniColor to work with other cross platform namespaces. - SkiaSharp - ImageSharp

BlyZe.UniColor.Extensions.Xamarin

An extension for UniColor to work with the Xamarin.Forms namespace

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 373 8/28/2022