ToolBX.ColorFull
1.0.5-beta1
See the version list below for details.
dotnet add package ToolBX.ColorFull --version 1.0.5-beta1
NuGet\Install-Package ToolBX.ColorFull -Version 1.0.5-beta1
<PackageReference Include="ToolBX.ColorFull" Version="1.0.5-beta1" />
paket add ToolBX.ColorFull --version 1.0.5-beta1
#r "nuget: ToolBX.ColorFull, 1.0.5-beta1"
// Install ToolBX.ColorFull as a Cake Addin #addin nuget:?package=ToolBX.ColorFull&version=1.0.5-beta1&prerelease // Install ToolBX.ColorFull as a Cake Tool #tool nuget:?package=ToolBX.ColorFull&version=1.0.5-beta1&prerelease
ColorFull
A lightweight re-implementation of the color struct.
The color struct from .NET's System.Drawing is rather heavy when you really just want a container for red, green, blue and alpha values.
This library aims to change that by providing easier to use methods and clearer names.
Game engines often re-implement this struct in their own way and this small package is meant to unify these implementations under a simpler type.
Getting started
public void SomeShadyMethod()
{
//Returns a color with red, green and blue values. Alpha is implicitly maxed out (255)
var color1 = new Color(255, 255, 125);
//Alpha is specified in this case
var color2 = new Color(68, 125, 200, 45);
//You can also just use the initializer if you're one of those people who hate constructors. Omitting alpha also initializes it to 255
var color3 = new Color
{
Red = 250,
Green = 128,
Blue = 114
};
//Or you can also just specify it as well
var color4 = new Color
{
Red = 250,
Green = 128,
Blue = 114,
Alpha = 150
};
//Or if you really just want a red color with nothing else
var color5 = new Color { Red = 255 };
//If you liked color3 but wanted to adjust its blue value
var color6 = color3 with { Blue = 189 };
}
Compatibility with System.Drawing
Yes, you can actually use it instead of System.Drawing since it has an implicit conversion operator.
What that means is that whenever you use ColorFull.Color in a method that asks for System.Drawing.Color, .NET will automatically convert that ColorFull.Color to a System.Drawing.Color under the hood.
I wouldn't abuse it but it's there if you need it.
Did you seriously create a whole package just for a measly little struct?!
Yeah, I did. It might grow beyond that and include more eventually. Or not.
Product | Versions 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. 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. |
-
net6.0
- ToolBX.Mathemancy.Interpolation (>= 1.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ToolBX.ColorFull:
Package | Downloads |
---|---|
ToolBX.DML.NET
.NET implementation of the Dialog Markup Language. |
|
ToolBX.MisterTerminal
A high level library to easily and cleanly build smarter console applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.0.0 | 1,171 | 9/26/2024 |
3.0.0-beta1 | 119 | 9/23/2024 |
2.2.1 | 838 | 1/13/2024 |
2.2.0-beta1 | 144 | 1/7/2024 |
2.0.3 | 245 | 6/19/2023 |
2.0.2 | 316 | 4/27/2023 |
2.0.1 | 322 | 12/3/2022 |
2.0.0 | 417 | 11/10/2022 |
2.0.0-beta2 | 143 | 10/3/2022 |
2.0.0-beta1 | 157 | 9/21/2022 |
1.0.5 | 450 | 9/21/2022 |
1.0.5-beta1 | 155 | 8/1/2022 |
1.0.4 | 446 | 7/17/2022 |
1.0.2 | 414 | 6/27/2022 |
1.0.1 | 700 | 5/9/2022 |
1.0.0 | 534 | 1/14/2022 |