Releases: abjerner/Skybrud.Colors
v1.1.1
Installation
Via NuGet:
.NET CLI:
dotnet add package Skybrud.Colors --version 1.1.1
NuGet Package Manager:
Install-Package Skybrud.Colors -Version 1.1.1
Changelog
v1.1.0
New major minor release.
Installation
Via NuGet:
.NET CLI:
dotnet add package Skybrud.Colors --version 1.1.0
NuGet Package Manager:
Install-Package Skybrud.Colors -Version 1.1.0
Changelog
-
Added support for nullable reference types
-
Added better parsing logic
-
Added logic for additional color operations
Skybrud.Colors v1.0.3
Installation
Changelog
-
Added more conversion logic to the
ColorUtils
class (see 9031c57, fd4fde5, f0086b0)
This adds more logic for converting back and forth between the supported color models. -
Added support for the HSV color model (see 0f86d11)
This release adds support for the HSV color model, which works in a similar way to HSL, but differs with the Value component opposed to the Lightness component of HSL. -
Introduced new extension methods for various color operations (see 45855cb)
TheColorExtensions
class now containsSaturate
,Desaturate
,Darken
,Lighten
,Invert
andGrayscale
extension methods for doing operations onIColor
instances. -
Introduced new
ColorUtils.HexToRgb
utility methods (see #2, c1c558f, 7d41437)
The methods either allow converting a HEX string value into an instance ofRgbColor
or into correspondingred
,green
andblue
components - thanks to a PR from @hfloyd. -
Copied logic from
ColorHelpers
class into theColorUtils
class, and marked theColorHelpers
class as obsolete (see #3, 7d41437 and 09cf9db)
Being a class with static utility methods, the class should be calledColorUtils
instead ofColorHelpers
to matching the name in our other packages. TheColorHelpers
class is still kept for backwards compatibility, but now marked as obsolete. -
Introduced new
WcagUtils
to replace theWcagHelpes
class (see 6a4c321)
Being a class with static utility methods, the class should be calledWcagUtils
instead ofWcagHelpes
to matching the name in our other packages. TheWcagHelpes
class is still kept for backwards compatibility, but now marked as obsolete. -
Introduced
ColorUtils.Clamp
methods (see ad52a29 and 240c528)
TheClamp
methods are used internally throughout the package to ensure specified values are within the allowed ranges. Eg. for the RGB color model, thered
,green
andblue
components range from0
to255
. If a value lower than0
is specified, the value is "clamped" to0
, and if a value higher than255
is specified, the value is clamped to255
- essentially a combination of theMath.Min
andMath.Max
methods.. -
Introduced new
ColorExtensions.Spin
extension method (see a2534be)
When using the HSL color model, thehue
component is specified as an angle on a circle, and theSpin
method can be used to increate or decrease the angle to get a different color, but with the samesaturation
andlightness
values. -
Added support for alpha values (see 4a0260a and 9720a8b)
With this release, theIColor
and the different color models now support an alpha component indicating the transparency of the color, The value ranges from0
(fully transparent) to1
(fully opaque). -
Introduced new
HexFormat
enum class andToHex
method overload to support both RGB and RGBA (see 9720a8b)
By default the parameterlessToHex
method returns a HEX value in the format of#RRGGBB
for fully opaque colors, and in the format of#RRGGBBAA
for non-opaque colors, which calling the new overload withHexFormat.Auto
. If either of the two formats is always preferred,HexFormat.Rgb
can be used to force the format to be#RRGGBB
, andHexFormat.Rgba
can be used to force the format to be#RRGGBBAA
. -
Introduced new
ColorUtils.GetGradientColors
andColorUtils.GetGradientColorsAsHex
methods (see #4, f8b613d, 435e7df, 3cac602 and 1f259f3)
Thanks to another PR from @hfloyd, theColorUtils.GetGradientColors
method allows generating a collection ofIColor
instances representing a gradient starting fromstartColor
toendColor
. TheGetGradientColorsAsHex
allows doing the same, but with HEX string values as both input and output. -
Added support for HEX alpha values to the ColorUtils.TryParse method (see d9ad869)
As part of adding alpha level support, theColorUtils.TryParse
method now also supports the#RRGGBBAA
format. -
Introduced new
ToCmy
,ToCmyk
,ToHsl
,ToHsv
andToRgb
extension methods for converting a collection ofIColor
to a specific color model (see dd2a753)
The new extension methods allows converting multiple colors to a given color model. Eg. theToRgb
extension method converts a collection ofIColor
into a corresponding collection ofRgbColor
.
Skybrud.Colors v1.0.2
Installation
Changelog
- Added support for multiple target frameworks so the package now supports both .NET Standard and .NET Framework.