• Stars
    star
    265
  • Rank 148,968 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created over 10 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎨 Open source .NET library for working with color spaces.

Colourful logo Colourful .NET

Build status Tests codecov NuGet version NuGet downloads API documentation

Open source .NET library for working with color spaces.

The library is written in C# and released with an MIT license, so feel free to fork or use commercially.

Any feedback is appreciated, please visit the issues page or send me an e-mail.

Download

Binaries of the last build can be downloaded on the AppVeyor CI page of the project.

The library is also published on NuGet.org, install using:

PM> Install-Package Colourful

Colourful is CLS Compliant (to allow use in VB.NET etc.) and is built for these target frameworks:

  • .NET 6 or newer
  • .NET Framework 4.5
  • .NET Standard 2.0
  • .NET Standard 1.1
  • For older .NET Framework 4.0 see version 1 of the library.

Usage

Example "hello world" usage that converts a color from sRGB to XYZ (keeping the D65 white point):

IColorConverter<RGBColor, XYZColor> converter = new ConverterBuilder()
    .FromRGB(RGBWorkingSpaces.sRGB)
    .ToXYZ(Illuminants.D65)
    .Build();

RGBColor rgbColor = new RGBColor(1, 0, 0.5);
XYZColor xyzColor = converter.Convert(rgbColor); // XYZ [X=0.45, Y=0.23, Z=0.22]

Documentation

Please see the docs pages below for various topics:

  • Conversion between color spaces
    • also handles chromatic adaptation with multiple possible LMS transformation matrices:
      • Bradford (default)
      • Von Kries (Hunt-Pointer-Estevez adjusted for D65)
      • Von Kries (Hunt-Pointer-Estevez for equal energy)
      • XYZ scaling
      • Spectral-sharpened Bradford
      • CMCCAT2000
      • CAT02
      • (user-defined chromatic adaptation matrix)
  • Correlated color temperature (CCT)
    • Planckian locus approximation method
  • Ranges of channel values and clamping
  • Computing color difference
    • multiple algorithms supported:
      • CIE Delta-E 1976
      • CMC l:c (1984)
      • CIE Delta-E 1994
      • CIE Delta-E 2000
      • JzCzhz Delta-Ez
      • Euclidean distance
  • Cylindrical color spaces
  • Illuminants and white points
    • white points are handled correctly throughout the conversions
    • multiple illuminant are built-in:
      • A (Incandescent / Tungsten)
      • B (Direct sunlight at noon (obsolete))
      • C (Average / North sky Daylight (obsolete))
      • D50 (Horizon Light. ICC profile PCS)
      • D55 (Mid-morning / Mid-afternoon Daylight)
      • D65 (Noon Daylight: Television, sRGB color space)
      • D75 (North sky Daylight)
      • E (Equal energy)
      • F2 (Cool White Fluorescent)
      • F7 (D65 simulator, Daylight simulator)
      • F11 (Philips TL84, Ultralume 40)
      • (user-defined white points)
  • Macbeth ColorChecker chart
  • Changes between v2 and v3

For information about specific color spaces, see the following docs pages:

  • RGB color spaces
    • support for both ordinary RGB and linear RGB
    • multiple working spaces supported:
      • sRGB
      • Simplified sRGB
      • ECI RGB v2
      • Adobe RGB (1998)
      • Apple sRGB
      • Best RGB
      • Beta RGB
      • Bruce RGB
      • CIE RGB
      • ColorMatch RGB
      • Don RGB 4
      • Ekta Space PS5
      • NTSC RGB
      • PAL/SECAM RGB
      • ProPhoto RGB
      • SMPTE-C RGB
      • Wide Gamut RGB
      • Rec. 709 (ITU-R Recommendation BT.709 – HDTV)
      • Rec. 2020 (ITU-R Recommendation BT.2020 – UHDTV)
      • (user-defined RGB working spaces)
  • Lab color spaces
    • CIE L*a*b* (1976) (CIELAB)
    • CIE L*C*hΒ°ab (CIELCH)
    • Hunter Lab
  • Luv color spaces
    • CIE L*u*v* (1976) (CIELUV)
    • CIE L*C*hΒ°uv (CIELCH)
  • XYZ color space
    • CIE XYZ (1931)
    • CIE xyY (derived from XYZ)
  • Jzazbz color spaces
    • Jzazbz (Safdar & al., 2017)
    • JzCzhz (polar of Jzazbz)
  • LMS color space
  • xy chromaticity