CasualDev.ColorLib 1.2.1

dotnet add package CasualDev.ColorLib --version 1.2.1
                    
NuGet\Install-Package CasualDev.ColorLib -Version 1.2.1
                    
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="CasualDev.ColorLib" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CasualDev.ColorLib" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="CasualDev.ColorLib" />
                    
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 CasualDev.ColorLib --version 1.2.1
                    
#r "nuget: CasualDev.ColorLib, 1.2.1"
                    
#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 CasualDev.ColorLib@1.2.1
                    
#: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=CasualDev.ColorLib&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=CasualDev.ColorLib&version=1.2.1
                    
Install as a Cake Tool

CasualDev.ColorLib

A C# Library that adds a data type for storing colour values.

Installation

This library can be installed on Visual Studio 2022 or in the terminal, with the following command.

If you experience any errors, please make sure that you are executing the command in the root of your repository.
dotnet add package CasualDev.ColorLib --version 1.2.1

Description & Syntax

CasualDev.ColorLib adds a hex struct that can be referenced like any regular data type. This contains:

  • Hex.Blend() which blends two colors together, with a given alpha, returning a mix of these colors as a hex data type.
  • Hex.Lighten() which lightens a color, returning a lighter color as a hex data type.
  • Hex.Darken() which darkens a color, returning a darker color as a hex data type.
  • Hex.SetTextColor() which sets the color of the following text.
  • Hex.SetBackgroundColor() which sets the background color of the following text.
  • Hex.Reset() which resets all color setting configurations and resets the text back to plain white.
  • Hex.ToString() which returns the hex in string representation for display of hexadecimal codes.

The syntax for declaring types of hex and using them are as follows:

using CasualDev.ColorLib;

namespace TestApplication
{
  class Program
  {
    Hex red = 0xFF0000;
    red.SetTextColor();
    Console.WriteLine($"The color of this text is {red.ToString()}!");

    Hex.Reset();
  }
}

Version & Patch Notes

Version 1.2.1 is a "minor and patch" type update.

The following is updated and/or fixed:

  • "hex" struct renamed to "Hex"
  • Hex.Blend() updated to blend with increased accuracy

Licensing

This project is licensed under the Mozilla Public License 2.0. See the full license at: https://opensource.org/licenses/MPL-2.0

Works using this library are not required to provide credit as long as the source code of this project is not modified. If you modify or redistribute this project, you must comply with the terms of the MPL-2.0, which include providing attribution and making the modified source code available under the same license.

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

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • 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
1.2.1 159 4/5/2025
1.1.3 193 4/3/2025