Skip to content

Commit 2929e25

Browse files
committed
Merge branch 'v6.1' into 'main'
Prepare version 6.1 See merge request Wacton/Unicolour!91
2 parents e6d5941 + 2b995e4 commit 2929e25

File tree

569 files changed

+300
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

569 files changed

+300
-244
lines changed

Example.Console/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static Table GetTable(Unicolour colour)
7878
table.AddRow("Ydbdr", $"{colour.Ydbdr}");
7979
table.AddRow("Tsl", $"{colour.Tsl}");
8080
table.AddRow("Xyb", $"{colour.Xyb}");
81+
table.AddRow("Lms", $"{colour.Lms}");
8182
table.AddRow("Ipt", $"{colour.Ipt}");
8283
table.AddRow("Ictcp", $"{colour.Ictcp}");
8384
table.AddRow("Jzazbz", $"{colour.Jzazbz}");

Example.Web/ColourLookup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ internal static class ColourLookup
2828
{ ColourSpace.Ydbdr, [new(0, 1), new(-1.333, 1.333), new(-1.333, 1.333)] },
2929
{ ColourSpace.Tsl, [new(0, 360), new(0, 1), new(0, 1)] },
3030
{ ColourSpace.Xyb, [new(-0.03, 0.03), new(0, 1.0), new(-0.4, 0.4)] },
31+
{ ColourSpace.Lms, [new(0, 1), new(0, 1), new(0, 1)] },
3132
{ ColourSpace.Ipt, [new(0, 1), new(-0.75, 0.75), new(-0.75, 0.75)] },
3233
{ ColourSpace.Ictcp, [new(0, 1), new(-0.5, 0.5), new(-0.5, 0.5)] },
3334
{ ColourSpace.Jzazbz, [new(0, 1), new(-0.21, 0.21), new(-0.21, 0.21)] },
@@ -70,6 +71,7 @@ internal static class ColourLookup
7071
{ ColourSpace.Ydbdr, ["Y", "Db", "Dr"] },
7172
{ ColourSpace.Tsl, ["T", "S", "L"] },
7273
{ ColourSpace.Xyb, ["X", "Y", "B"] },
74+
{ ColourSpace.Lms, ["L", "M", "S"] },
7375
{ ColourSpace.Ipt, ["I", "P", "T"] },
7476
{ ColourSpace.Ictcp, ["I", "Ct", "Cp"] },
7577
{ ColourSpace.Jzazbz, ["J", "A", "B"] },

README.md

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ It can be used to [mix and compare colours](#mix-colours), and offers [many usef
4646
> CIELAB · CIELCh<sub>ab</sub> · CIELUV · CIELCh<sub>uv</sub> · HSLuv · HPLuv ·
4747
> YPbPr · YCbCr&nbsp;/&nbsp;YUV&nbsp;_(digital)_ · YCgCo · YUV&nbsp;_(PAL)_ · YIQ&nbsp;_(NTSC)_ · YDbDr&nbsp;_(SECAM)_ ·
4848
> TSL · XYB ·
49-
> IPT · IC<sub>T</sub>C<sub>P</sub> · J<sub>z</sub>a<sub>z</sub>b<sub>z</sub> · J<sub>z</sub>C<sub>z</sub>h<sub>z</sub> ·
49+
> LMS · IPT · IC<sub>T</sub>C<sub>P</sub> · J<sub>z</sub>a<sub>z</sub>b<sub>z</sub> · J<sub>z</sub>C<sub>z</sub>h<sub>z</sub> ·
5050
> Oklab · Oklch · Okhsv · Okhsl · Okhwb · Okl<sub>r</sub>ab · Okl<sub>r</sub>ch ·
5151
> CIECAM02 · CAM16 ·
5252
> HCT ·
@@ -164,6 +164,7 @@ var (l, c, h) = colour.Oklch;
164164
| YDbDr&nbsp;_(SECAM)_ | `ColourSpace.Ydbdr` | `.Ydbdr` |
165165
| TSL | `ColourSpace.Tsl` | `.Tsl` |
166166
| XYB | `ColourSpace.Xyb` | `.Xyb` |
167+
| LMS | `ColourSpace.Lms` | `.Lms` |
167168
| IPT | `ColourSpace.Ipt` | `.Ipt` |
168169
| IC<sub>T</sub>C<sub>P</sub> | `ColourSpace.Ictcp` | `.Ictcp` |
169170
| J<sub>z</sub>a<sub>z</sub>b<sub>z</sub> | `ColourSpace.Jzazbz` | `.Jzazbz` |
@@ -222,30 +223,31 @@ flowchart LR
222223
YDBDR("YDbDr (SECAM)")
223224
TSL(TSL)
224225
XYB(XYB)
225-
IPT(IPT)
226-
ICTCP(ICtCp)
227-
JZAZBZ(JzAzBz)
228-
JZCZHZ(JzCzHz)
229-
OKLAB(Oklab)
230-
OKLCH(Oklch)
231-
OKHSV(Okhsv)
232-
OKHSL(Okhsl)
233-
OKHWB(Okhwb)
234-
OKLRAB(Oklrab)
235-
OKLRCH(Oklrch)
226+
LMS([LMS])
227+
IPT{{IPT}}
228+
ICTCP{{ICtCp}}
229+
JZAZBZ{{JzAzBz}}
230+
JZCZHZ{{JzCzHz}}
231+
OKLAB{{Oklab}}
232+
OKLCH{{Oklch}}
233+
OKHSV{{Okhsv}}
234+
OKHSL{{Okhsl}}
235+
OKHWB{{Okhwb}}
236+
OKLRAB{{Oklrab}}
237+
OKLRCH{{Oklrch}}
236238
CAM02(CAM02)
237239
CAM02UCS(CAM02-UCS)
238240
CAM16(CAM16)
239241
CAM16UCS(CAM16-UCS)
240-
HCT(HCT)
241-
ICC("ICC Profile")
242+
HCT{{HCT}}
243+
ICC(["ICC Profile"])
242244
CMYK("CMYK")
243-
CMYKOGV("CMYKOGV")
244-
245+
245246
XYZ --> ICC
246-
ICC -.-> CMYKOGV
247247
ICC -.-> CMYK
248248
RGB -.-> CMYK
249+
XYZ --> XYY
250+
XYY --> WXY
249251
XYZ --> RGBLIN
250252
RGBLIN --> RGB
251253
RGB --> HSB
@@ -260,14 +262,13 @@ flowchart LR
260262
YUV --> YDBDR
261263
RGB --> TSL
262264
RGBLIN --> XYB
263-
XYZ --> XYY
264-
XYY --> WXY
265265
XYZ --> LAB
266266
LAB --> LCHAB
267267
XYZ --> LUV
268268
LUV --> LCHUV
269269
LCHUV --> HSLUV
270270
LCHUV --> HPLUV
271+
XYZ --> LMS
271272
XYZ --> IPT
272273
XYZ --> ICTCP
273274
XYZ --> JZAZBZ
@@ -287,9 +288,12 @@ flowchart LR
287288
```
288289

289290
This diagram summarises how colour space conversions are implemented in Unicolour.
290-
Arrows indicate forward transformations from one space to another.
291-
For each forward transformation there is a corresponding reverse transformation.
292-
XYZ is considered the root colour space.
291+
- XYZ is considered the root colour space
292+
- Arrows indicate forward transformations from one colour space to another
293+
- For each forward transformation there is a corresponding reverse transformation
294+
- Square nodes indicate colour spaces affected by white point configuration
295+
- Hexagonal nodes indicate colour spaces restricted to D65/2°
296+
- Rounded nodes indicate colour spaces unaffected by white point configuration
293297
</details>
294298

295299
### Mix colours
@@ -384,17 +388,23 @@ var surfaceRed = veryRed.MapToPointerGamut();
384388

385389
### Simulate colour vision deficiency
386390
Colour vision deficiency (CVD) or colour blindness can be simulated, conveying how a particular colour might be perceived.
391+
Anomalous trichromacy, where cones are defective instead of missing, can be adjusted using the severity parameter.
387392
```c#
388393
var colour = new Unicolour(ColourSpace.Rgb255, 192, 255, 238);
389-
var noRed = colour.Simulate(Cvd.Protanopia);
394+
var missingRed = colour.Simulate(Cvd.Protanopia);
395+
var defectiveRed = colour.Simulate(Cvd.Protanomaly, 0.5);
390396
```
391397

392-
| Colour&nbsp;vision&nbsp;deficiency | Enum |
393-
|-----------------------------------------------------|---------------------|
394-
| Protanopia&nbsp;(no&nbsp;red&nbsp;perception) | `Cvd.Protanopia` |
395-
| Deuteranopia&nbsp;(no&nbsp;green&nbsp;perception) | `Cvd.Deuteranopia` |
396-
| Tritanopia&nbsp;(no&nbsp;blue&nbsp;perception) | `Cvd.Tritanopia` |
397-
| Achromatopsia&nbsp;(no&nbsp;colour&nbsp;perception) | `Cvd.Achromatopsia` |
398+
| Colour&nbsp;vision&nbsp;deficiency | Enum |
399+
|---------------------------------------------------------------------------------------|----------------------------|
400+
| Protanopia&nbsp;(missing&nbsp;red&nbsp;cones) | `Cvd.Protanopia` |
401+
| Protanomaly&nbsp;(defective&nbsp;red&nbsp;cones) | `Cvd.Protanomaly` |
402+
| Deuteranopia&nbsp;(missing&nbsp;green&nbsp;cones) | `Cvd.Deuteranopia` |
403+
| Deuteranomaly&nbsp;(defective&nbsp;green&nbsp;cones) | `Cvd.Deuteranomaly` |
404+
| Tritanopia&nbsp;(missing&nbsp;blue&nbsp;cones) | `Cvd.Tritanopia` |
405+
| Tritanomaly&nbsp;(defective&nbsp;blue&nbsp;cones) | `Cvd.Tritanomaly` |
406+
| Blue&nbsp;cone&nbsp;monochromacy&nbsp;(missing&nbsp;red&nbsp;&&nbsp;green&nbsp;cones) | `Cvd.BlueConeMonochromacy` |
407+
| Achromatopsia&nbsp;(missing&nbsp;all&nbsp;cones) | `Cvd.Achromatopsia` |
398408

399409
### Convert between colour and temperature
400410
Correlated colour temperature (CCT) and delta UV (∆<sub>uv</sub>) of a colour can be ascertained, and can be used to create a colour.
@@ -717,7 +727,7 @@ Some commonly used profiles can be found in the [ICC profile registry](https://w
717727
- Rendering intent
718728

719729
### White points
720-
All colour spaces are impacted by the reference white point.
730+
Most colour spaces are impacted by the reference white point.
721731
Unicolour applies different reference white points to different sets of colour spaces, as shown in the table below.
722732
When a [conversion to or from XYZ space](#convert-between-colour-spaces) involves a change in white point, a chromatic adaptation transform (CAT) is performed.
723733
The default chromatic adaptation is the Bradford method but [this can be customised](#xyzconfiguration).

Unicolour.Readme/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ flowchart LR
223223
YDBDR("YDbDr (SECAM)")
224224
TSL(TSL)
225225
XYB(XYB)
226-
LMS((LMS))
226+
LMS([LMS])
227227
IPT{{IPT}}
228228
ICTCP{{ICtCp}}
229229
JZAZBZ{{JzAzBz}}
@@ -240,7 +240,7 @@ flowchart LR
240240
CAM16(CAM16)
241241
CAM16UCS(CAM16-UCS)
242242
HCT{{HCT}}
243-
ICC("ICC Profile")
243+
ICC(["ICC Profile"])
244244
CMYK("CMYK")
245245
246246
XYZ --> ICC
@@ -289,11 +289,11 @@ flowchart LR
289289

290290
This diagram summarises how colour space conversions are implemented in Unicolour.
291291
- XYZ is considered the root colour space
292-
- Arrows indicate forward transformations from one space to another
292+
- Arrows indicate forward transformations from one colour space to another
293293
- For each forward transformation there is a corresponding reverse transformation
294-
- Nodes with rounded edges indicate spaces affected by white point configuration
295-
- Hexagonal nodes indicate spaces restricted to D65/2°
296-
- Circular nodes indicate spaces unaffected by white point configuration
294+
- Square nodes indicate colour spaces affected by white point configuration
295+
- Hexagonal nodes indicate colour spaces restricted to D65/2°
296+
- Rounded nodes indicate colour spaces unaffected by white point configuration
297297
</details>
298298

299299
### Mix colours

Unicolour.Readme/README_Unicolour_nuget.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![GitLab](https://badgen.net/static/gitlab/source/ff1493?icon=gitlab)](https://gitlab.com/Wacton/Unicolour)
44
[![NuGet](https://badgen.net/nuget/v/Wacton.Unicolour?icon)](https://www.nuget.org/packages/Wacton.Unicolour/)
55
[![pipeline status](https://gitlab.com/Wacton/Unicolour/badges/main/pipeline.svg)](https://gitlab.com/Wacton/Unicolour/-/commits/main)
6-
[![tests passed](https://badgen.net/static/tests/223,239/green/)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
6+
[![tests passed](https://badgen.net/static/tests/225,669/green/)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
77
[![coverage report](https://gitlab.com/Wacton/Unicolour/badges/main/coverage.svg)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
88

99
Unicolour is the most comprehensive .NET library for working with colour:
@@ -45,7 +45,7 @@ It can be used to [mix and compare colours](https://github.com/waacton/Unicolour
4545
> CIELAB · CIELChab · CIELUV · CIELChuv · HSLuv · HPLuv ·
4646
> YPbPr · YCbCr&nbsp;/&nbsp;YUV&nbsp;_(digital)_ · YCgCo · YUV&nbsp;_(PAL)_ · YIQ&nbsp;_(NTSC)_ · YDbDr&nbsp;_(SECAM)_ ·
4747
> TSL · XYB ·
48-
> IPT · ICTCP · Jzazbz · JzCzhz ·
48+
> LMS · IPT · ICTCP · Jzazbz · JzCzhz ·
4949
> Oklab · Oklch · Okhsv · Okhsl · Okhwb · Oklrab · Oklrch ·
5050
> CIECAM02 · CAM16 ·
5151
> HCT ·
@@ -163,6 +163,7 @@ var (l, c, h) = colour.Oklch;
163163
| YDbDr&nbsp;_(SECAM)_ | `ColourSpace.Ydbdr` | `.Ydbdr` |
164164
| TSL | `ColourSpace.Tsl` | `.Tsl` |
165165
| XYB | `ColourSpace.Xyb` | `.Xyb` |
166+
| LMS | `ColourSpace.Lms` | `.Lms` |
166167
| IPT | `ColourSpace.Ipt` | `.Ipt` |
167168
| ICTCP | `ColourSpace.Ictcp` | `.Ictcp` |
168169
| Jzazbz | `ColourSpace.Jzazbz` | `.Jzazbz` |
@@ -271,17 +272,23 @@ var surfaceRed = veryRed.MapToPointerGamut();
271272
272273
### Simulate colour vision deficiency
273274
Colour vision deficiency (CVD) or colour blindness can be simulated, conveying how a particular colour might be perceived.
275+
Anomalous trichromacy, where cones are defective instead of missing, can be adjusted using the severity parameter.
274276
```c#
275277
var colour = new Unicolour(ColourSpace.Rgb255, 192, 255, 238);
276-
var noRed = colour.Simulate(Cvd.Protanopia);
278+
var missingRed = colour.Simulate(Cvd.Protanopia);
279+
var defectiveRed = colour.Simulate(Cvd.Protanomaly, 0.5);
277280
```
278281
279-
| Colour&nbsp;vision&nbsp;deficiency | Enum |
280-
|-----------------------------------------------------|---------------------|
281-
| Protanopia&nbsp;(no&nbsp;red&nbsp;perception) | `Cvd.Protanopia` |
282-
| Deuteranopia&nbsp;(no&nbsp;green&nbsp;perception) | `Cvd.Deuteranopia` |
283-
| Tritanopia&nbsp;(no&nbsp;blue&nbsp;perception) | `Cvd.Tritanopia` |
284-
| Achromatopsia&nbsp;(no&nbsp;colour&nbsp;perception) | `Cvd.Achromatopsia` |
282+
| Colour&nbsp;vision&nbsp;deficiency | Enum |
283+
|---------------------------------------------------------------------------------------|----------------------------|
284+
| Protanopia&nbsp;(missing&nbsp;red&nbsp;cones) | `Cvd.Protanopia` |
285+
| Protanomaly&nbsp;(defective&nbsp;red&nbsp;cones) | `Cvd.Protanomaly` |
286+
| Deuteranopia&nbsp;(missing&nbsp;green&nbsp;cones) | `Cvd.Deuteranopia` |
287+
| Deuteranomaly&nbsp;(defective&nbsp;green&nbsp;cones) | `Cvd.Deuteranomaly` |
288+
| Tritanopia&nbsp;(missing&nbsp;blue&nbsp;cones) | `Cvd.Tritanopia` |
289+
| Tritanomaly&nbsp;(defective&nbsp;blue&nbsp;cones) | `Cvd.Tritanomaly` |
290+
| Blue&nbsp;cone&nbsp;monochromacy&nbsp;(missing&nbsp;red&nbsp;&&nbsp;green&nbsp;cones) | `Cvd.BlueConeMonochromacy` |
291+
| Achromatopsia&nbsp;(missing&nbsp;all&nbsp;cones) | `Cvd.Achromatopsia` |
285292
286293
### Convert between colour and temperature
287294
Correlated colour temperature (CCT) and delta UV (∆uv) of a colour can be ascertained, and can be used to create a colour.
@@ -550,7 +557,7 @@ Some commonly used profiles can be found in the [ICC profile registry](https://w
550557
- Rendering intent
551558
552559
### White points
553-
All colour spaces are impacted by the reference white point.
560+
Most colour spaces are impacted by the reference white point.
554561
Unicolour applies different reference white points to different sets of colour spaces, as shown in the table below.
555562
When a [conversion to or from XYZ space](https://github.com/waacton/Unicolour#convert-between-colour-spaces) involves a change in white point, a chromatic adaptation transform (CAT) is performed.
556563
The default chromatic adaptation is the Bradford method but [this can be customised](https://github.com/waacton/Unicolour#xyzconfiguration).
-1.07 KB
Loading

Unicolour/Unicolour.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
1010
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
11-
<Version>6.0.0</Version>
11+
<Version>6.1.0</Version>
1212
<Authors>William Acton</Authors>
1313
<Description>🌈 Colour / Color conversion, interpolation, and comparison for .NET</Description>
1414
<Copyright>William Acton</Copyright>
1515
<PackageProjectUrl>https://github.com/waacton/Unicolour</PackageProjectUrl>
1616
<RepositoryUrl>https://github.com/waacton/Unicolour</RepositoryUrl>
17-
<PackageTags>colour color RGB HSB HSV HSL HWB HSI XYZ xyY WXY LAB LUV LCH LCHab LCHuv HSLuv HPLuv YPbPr YCbCr YCgCo YUV YIQ YDbDr TSL XYB IPT ICtCp JzAzBz JzCzHz Oklab Oklch Okhsv Okhsl Okhwb Oklrab Oklrch CAM02 CAM16 HCT ICC icc-profile CMYK CMYKOGV converter colour-converter colour-conversion color-converter color-conversion colour-space colour-spaces color-space color-spaces interpolation colour-interpolation color-interpolation colour-mixing color-mixing colour-blending color-blending color-palette colour-palette comparison colour-comparison color-comparison contrast luminance delta-e deltaE chromaticity display-p3 rec-2020 rec-2100 rec-2100-pq rec-2100-hlg rec-601 rec-709 A98 ProPhoto ACES ACEScg ACEScct ACEScc xvYCC PAL NTSC SECAM HDR chromatic-adaptation gamut-map gamut-mapping pointers-gamut temperature cct duv cvd colour-vision-deficiency color-vision-deficiency colour-blindness color-blindness protanopia deuteranopia tritanopia achromatopsia spd dominant-wavelength excitation-purity imaginary-color imaginary-colour pigments pigment-mixing kubelka-munk paints paint-mixing</PackageTags>
18-
<PackageReleaseNotes>Add configurable dynamic range, custom chromatic adaptation, Pointer's gamut mapping, layering colours with blending &amp; compositing, Oklrab &amp; Oklrch support</PackageReleaseNotes>
17+
<PackageTags>colour color RGB HSB HSV HSL HWB HSI XYZ xyY WXY LAB LUV LCH LCHab LCHuv HSLuv HPLuv YPbPr YCbCr YCgCo YUV YIQ YDbDr TSL XYB LMS IPT ICtCp JzAzBz JzCzHz Oklab Oklch Okhsv Okhsl Okhwb Oklrab Oklrch CAM02 CAM16 HCT ICC icc-profile CMYK CMYKOGV converter colour-converter colour-conversion color-converter color-conversion colour-space colour-spaces color-space color-spaces interpolation colour-interpolation color-interpolation colour-mixing color-mixing colour-blending color-blending color-palette colour-palette comparison colour-comparison color-comparison contrast luminance delta-e deltaE chromaticity display-p3 rec-2020 rec-2100 rec-2100-pq rec-2100-hlg rec-601 rec-709 A98 ProPhoto ACES ACEScg ACEScct ACEScc xvYCC PAL NTSC SECAM HDR chromatic-adaptation gamut-map gamut-mapping pointers-gamut temperature cct duv cvd colour-vision-deficiency color-vision-deficiency colour-blindness color-blindness protanopia protanomaly deuteranopia deuteranomaly tritanopia tritanomaly blue-cone-monochromacy achromatopsia spd dominant-wavelength excitation-purity imaginary-color imaginary-colour pigments pigment-mixing kubelka-munk paints paint-mixing</PackageTags>
18+
<PackageReleaseNotes>Add LMS colour space, expand CVDs (protanomaly, deuteranomaly, tritanomaly, blue cone monochromacy), support reading ICC profiles from streams</PackageReleaseNotes>
1919
<PackageIcon>Resources\Unicolour.png</PackageIcon>
2020
<PackageLicenseFile>LICENSE</PackageLicenseFile>
2121
<PackageReadmeFile>README_Unicolour_nuget.md</PackageReadmeFile>

0 commit comments

Comments
 (0)