Skip to content

Commit

Permalink
Merge branch 'v4.4' into 'main'
Browse files Browse the repository at this point in the history
Prepare version 4.4

See merge request Wacton/Unicolour!61
  • Loading branch information
waacton committed May 9, 2024
2 parents b6785d0 + b4748ae commit 63f1fb6
Show file tree
Hide file tree
Showing 28 changed files with 184 additions and 44 deletions.
2 changes: 2 additions & 0 deletions Example.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ static Table GetTable(Unicolour unicolour)
table.AddRow("Yuv", $"{unicolour.Yuv}");
table.AddRow("Yiq", $"{unicolour.Yiq}");
table.AddRow("Ydbdr", $"{unicolour.Ydbdr}");
table.AddRow("Tsl", $"{unicolour.Tsl}");
table.AddRow("Xyb", $"{unicolour.Xyb}");
table.AddRow("Ipt", $"{unicolour.Ipt}");
table.AddRow("Ictcp", $"{unicolour.Ictcp}");
table.AddRow("Jzazbz", $"{unicolour.Jzazbz}");
Expand Down
1 change: 1 addition & 0 deletions Example.Gradients/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Image<Rgba32> DrawColumn(Unicolour[] colourPoints)
Utils.Draw(("YIQ", text), columnWidth, rowHeight, GetColour(ColourSpace.Yiq)),
Utils.Draw(("YDbDr", text), columnWidth, rowHeight, GetColour(ColourSpace.Ydbdr)),
Utils.Draw(("TSL", text), columnWidth, rowHeight, GetColour(ColourSpace.Tsl)),
Utils.Draw(("XYB", text), columnWidth, rowHeight, GetColour(ColourSpace.Xyb)),
Utils.Draw(("IPT", text), columnWidth, rowHeight, GetColour(ColourSpace.Ipt)),
Utils.Draw(("ICtCp", text), columnWidth, rowHeight, GetColour(ColourSpace.Ictcp)),
Utils.Draw(("JzAzBz", text), columnWidth, rowHeight, GetColour(ColourSpace.Jzazbz)),
Expand Down
2 changes: 2 additions & 0 deletions Example.Web/ColourLookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ internal static class ColourLookup
{ ColourSpace.Yiq, [new(0, 1), new(-0.60, 0.60), new(-0.53, 0.53)] },
{ ColourSpace.Ydbdr, [new(0, 1), new(-1.333, 1.333), new(-1.333, 1.333)] },
{ ColourSpace.Tsl, [new(0, 360), new(0, 1), new(0, 1)] },
{ ColourSpace.Xyb, [new(-0.03, 0.03), new(0, 1.0), new(-0.4, 0.4)] },
{ ColourSpace.Ipt, [new(0, 1), new(-0.75, 0.75), new(-0.75, 0.75)] },
{ ColourSpace.Ictcp, [new(0, 1), new(-0.5, 0.5), new(-0.5, 0.5)] },
{ ColourSpace.Jzazbz, [new(0, 0.17), new(-0.10, 0.11), new(-0.16, 0.12)] },
Expand Down Expand Up @@ -66,6 +67,7 @@ internal static class ColourLookup
{ ColourSpace.Yiq, ["Y", "I", "Q"] },
{ ColourSpace.Ydbdr, ["Y", "Db", "Dr"] },
{ ColourSpace.Tsl, ["T", "S", "L"] },
{ ColourSpace.Xyb, ["X", "Y", "B"] },
{ ColourSpace.Ipt, ["I", "P", "T"] },
{ ColourSpace.Ictcp, ["I", "Ct", "Cp"] },
{ ColourSpace.Jzazbz, ["J", "A", "B"] },
Expand Down
81 changes: 71 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ It can be used to [mix and compare colours](#mix-colours), as well as [other use

> **Supported colour spaces**
>
> RGB · Linear&nbsp;RGB · HSB&nbsp;/&nbsp;HSV · HSL · HWB ·
> RGB · Linear&nbsp;RGB · HSB&nbsp;/&nbsp;HSV · HSL · HWB · HSI ·
> CIEXYZ · CIExyY · CIELAB · CIELCh<sub>ab</sub> · CIELUV · CIELCh<sub>uv</sub> · HSLuv · HPLuv ·
> YPbPr · YCbCr&nbsp;/&nbsp;YUV&nbsp;_(digital)_ · YCgCo · YUV&nbsp;_(PAL)_ · YIQ&nbsp;_(NTSC)_ · YDbDr&nbsp;_(SECAM)_ ·
> YPbPr · YCbCr&nbsp;/&nbsp;YUV&nbsp;_(digital)_ · YCgCo · YUV&nbsp;_(PAL)_ · YIQ&nbsp;_(NTSC)_ · YDbDr&nbsp;_(SECAM)_ ·
> TSL · XYB ·
> 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> ·
> Oklab · Oklch · Okhsv · Okhsl · Okhwb ·
> CIECAM02 · CAM16 ·
Expand Down Expand Up @@ -133,6 +134,7 @@ var (l, c, h) = colour.Oklch.Triplet;
| HSB&nbsp;/&nbsp;HSV | `ColourSpace.Hsb` | `.Hsb` |
| HSL | `ColourSpace.Hsl` | `.Hsl` |
| HWB | `ColourSpace.Hwb` | `.Hwb` |
| HSI | `ColourSpace.Hsi` | `.Hsi` |
| CIEXYZ | `ColourSpace.Xyz` | `.Xyz` |
| CIExyY | `ColourSpace.Xyy` | `.Xyy` |
| CIELAB | `ColourSpace.Lab` | `.Lab` |
Expand All @@ -147,6 +149,8 @@ var (l, c, h) = colour.Oklch.Triplet;
| YUV&nbsp;_(PAL)_ | `ColourSpace.Yuv` | `.Yuv` |
| YIQ&nbsp;_(NTSC)_ | `ColourSpace.Yiq` | `.Yiq` |
| YDbDr&nbsp;_(SECAM)_ | `ColourSpace.Ydbdr` | `.Ydbdr` |
| TSL | `ColourSpace.Tsl` | `.Tsl` |
| XYB | `ColourSpace.Xyb` | `.Xyb` |
| IPT | `ColourSpace.Ipt` | `.Ipt` |
| IC<sub>T</sub>C<sub>P</sub> | `ColourSpace.Ictcp` | `.Ictcp` |
| J<sub>z</sub>a<sub>z</sub>b<sub>z</sub> | `ColourSpace.Jzazbz` | `.Jzazbz` |
Expand Down Expand Up @@ -199,7 +203,7 @@ flowchart TD
HSB(HSB / HSV)
HSL(HSL)
HWB(HWB)
CMYK(CMYK)
HSI(HSI)
XYY(xyY)
XYZ(XYZ)
LAB(LAB)
Expand All @@ -214,6 +218,8 @@ flowchart TD
YUV("YUV (PAL)")
YIQ("YIQ (NTSC)")
YDBDR("YDbDr (SECAM)")
TSL(TSL)
XYB(XYB)
IPT(IPT)
ICTCP(ICtCp)
JZAZBZ(JzAzBz)
Expand All @@ -228,20 +234,23 @@ flowchart TD
CAM16(CAM16)
CAM16UCS(CAM16-UCS)
HCT(HCT)
CMYK(CMYK)
RGB -.-> CMYK
XYZ --> RGBLIN
RGBLIN --> RGB
RGB --> HSB
HSB --> HSL
HSB --> HWB
RGB --> HSI
RGB --> YPBPR
YPBPR --> YCBCR
RGB --> YCGCO
RGB --> YUV
YUV --> YIQ
YUV --> YDBDR
RGB --> TSL
RGBLIN --> XYB
XYZ --> XYY
XYZ --> LAB
LAB --> LCHAB
Expand Down Expand Up @@ -457,6 +466,58 @@ Defines the RGB model, often used to specify a wider gamut than standard RGB (sR
| SECAM&nbsp;(Rec.&nbsp;470) | `.Secam` |
| SECAM&nbsp;625&nbsp;(Rec.&nbsp;1700) | `.Secam625` |

<details>
<summary>Diagram of RGB configurations</summary>

```mermaid
mindmap
root(RGB)
("R 0.64 0.33<br>G 0.30 0.60<br>B 0.15 0.06")
("D65")
("sRGB")
("Rec. 709")
("xvYCC")
("R 0.680 0.320<br>G 0.265 0.690<br>B 0.150 0.060")
("D65")
("Display P3")
("R 0.708 0.292<br>G 0.170 0.797<br>B 0.131 0.046")
("D65")
("Rec. 2020")
("R 0.64 0.33<br>G 0.21 0.71<br>B 0.15 0.06")
("D65")
("A98 RGB")
("R 0.734699 0.265301<br>G 0.159597 0.840403<br>B 0.036598 0.000105")
("D50")
("ProPhoto RGB")
("R 0.7347 0.2653<br>G 0.0000 1.0000<br>B 0.0001 -0.0770")
("W 0.32168 0.33767")
("ACES 2065-1")
("R 0.713 0.293<br>G 0.165 0.830<br>B 0.128 0.044")
("W 0.32168 0.33767")
("ACEScg")
("ACEScct")
("ACEScc")
("R 0.64 0.33<br>G 0.29 0.60<br>B 0.15 0.06")
("D65")
("Rec. 601 (625-line)")
("PAL (Rec. 470)")
("PAL 625 (Rec. 1700)")
("SECAM (Rec. 470)")
("SECAM 625 (Rec. 1700)")
("R 0.67 0.33<br>G 0.21 0.71<br>B 0.14 0.08")
("C")
("PAL-M (Rec. 470)")
("NTSC (Rec. 470)")
("R 0.630 0.340<br>G 0.310 0.595<br>B 0.155 0.070")
("C")
("PAL 525 (Rec. 1700)")
("D65")
("Rec. 601 (525-line)")
("NTSC (SMPTE-C)")
("NTSC 525 (Rec. 1700)")
```
</details>

- Parameters
- Red, green, and blue chromaticity coordinates
- Reference white point
Expand Down Expand Up @@ -513,12 +574,12 @@ All colour spaces are impacted by the reference white point.
Unicolour applies different reference white points to different sets of colour spaces, as shown in the table below.
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 using the Bradford method.

| White&nbsp;point&nbsp;configuration | Affected&nbsp;colour&nbsp;spaces |
|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `RgbConfiguration` | RGB · Linear&nbsp;RGB · HSB&nbsp;/&nbsp;HSV · HSL · HWB · YPbPr · YCbCr&nbsp;/&nbsp;YUV&nbsp;_(digital)_ · YCgCo · YUV&nbsp;_(PAL)_ · YIQ&nbsp;_(NTSC)_ · YDbDr&nbsp;_(SECAM)_ |
| `XyzConfiguration` | CIEXYZ · CIExyY · CIELAB · CIELCh<sub>ab</sub> · CIELUV · CIELCh<sub>uv</sub> · HSLuv · HPLuv |
| `CamConfiguration` | CIECAM02 · CAM16 |
| None (always D65/2°) | 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> · Oklab · Oklch · Okhsv · Okhsl · Okhwb · HCT |
| White&nbsp;point&nbsp;configuration | Affected&nbsp;colour&nbsp;spaces |
|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `RgbConfiguration` | RGB · Linear&nbsp;RGB · HSB&nbsp;/&nbsp;HSV · HSL · HWB · HSI · YPbPr · YCbCr&nbsp;/&nbsp;YUV&nbsp;_(digital)_ · YCgCo · YUV&nbsp;_(PAL)_ · YIQ&nbsp;_(NTSC)_ · YDbDr&nbsp;_(SECAM)_ · TSL · XYB |
| `XyzConfiguration` | CIEXYZ · CIExyY · CIELAB · CIELCh<sub>ab</sub> · CIELUV · CIELCh<sub>uv</sub> · HSLuv · HPLuv |
| `CamConfiguration` | CIECAM02 · CAM16 |
| None (always D65/2°) | 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> · Oklab · Oklch · Okhsv · Okhsl · Okhwb · HCT |

### Convert between configurations
A `Unicolour` can be converted to a different configuration,
Expand Down
3 changes: 2 additions & 1 deletion Unicolour.Readme/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void ProcessReadme()
.Replace("../", "https://github.com/waacton/Unicolour/tree/main/");

// until GitHub Pages supports Mermaid 😑 - just remove it
readmeDocsText = Regex.Replace(readmeDocsText, @"<details>(.|\n)*<\/details>", string.Empty);
readmeDocsText = Regex.Replace(readmeDocsText, @"<details>(.|\n)*?<\/details>", string.Empty);

var readmeUkText = readmeDocsText;
var readmeUsText = readmeDocsText;
Expand All @@ -40,6 +40,7 @@ void ProcessReadme()
.Replace("Colour ", "Color ")
.Replace("Colours ", "Colors ")
.Replace("Colour&", "Color&")
.Replace("colour&", "color&")
.Replace(" colour", " color")
.Replace("-colour", "-color")
.Replace(" grey ", " gray ")
Expand Down
81 changes: 71 additions & 10 deletions Unicolour.Readme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ It can be used to [mix and compare colours](#mix-colours), as well as [other use

> **Supported colour spaces**
>
> RGB · Linear&nbsp;RGB · HSB&nbsp;/&nbsp;HSV · HSL · HWB ·
> RGB · Linear&nbsp;RGB · HSB&nbsp;/&nbsp;HSV · HSL · HWB · HSI ·
> CIEXYZ · CIExyY · CIELAB · CIELCh<sub>ab</sub> · CIELUV · CIELCh<sub>uv</sub> · HSLuv · HPLuv ·
> YPbPr · YCbCr&nbsp;/&nbsp;YUV&nbsp;_(digital)_ · YCgCo · YUV&nbsp;_(PAL)_ · YIQ&nbsp;_(NTSC)_ · YDbDr&nbsp;_(SECAM)_ ·
> YPbPr · YCbCr&nbsp;/&nbsp;YUV&nbsp;_(digital)_ · YCgCo · YUV&nbsp;_(PAL)_ · YIQ&nbsp;_(NTSC)_ · YDbDr&nbsp;_(SECAM)_ ·
> TSL · XYB ·
> 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> ·
> Oklab · Oklch · Okhsv · Okhsl · Okhwb ·
> CIECAM02 · CAM16 ·
Expand Down Expand Up @@ -133,6 +134,7 @@ var (l, c, h) = colour.Oklch.Triplet;
| HSB&nbsp;/&nbsp;HSV | `ColourSpace.Hsb` | `.Hsb` |
| HSL | `ColourSpace.Hsl` | `.Hsl` |
| HWB | `ColourSpace.Hwb` | `.Hwb` |
| HSI | `ColourSpace.Hsi` | `.Hsi` |
| CIEXYZ | `ColourSpace.Xyz` | `.Xyz` |
| CIExyY | `ColourSpace.Xyy` | `.Xyy` |
| CIELAB | `ColourSpace.Lab` | `.Lab` |
Expand All @@ -147,6 +149,8 @@ var (l, c, h) = colour.Oklch.Triplet;
| YUV&nbsp;_(PAL)_ | `ColourSpace.Yuv` | `.Yuv` |
| YIQ&nbsp;_(NTSC)_ | `ColourSpace.Yiq` | `.Yiq` |
| YDbDr&nbsp;_(SECAM)_ | `ColourSpace.Ydbdr` | `.Ydbdr` |
| TSL | `ColourSpace.Tsl` | `.Tsl` |
| XYB | `ColourSpace.Xyb` | `.Xyb` |
| IPT | `ColourSpace.Ipt` | `.Ipt` |
| IC<sub>T</sub>C<sub>P</sub> | `ColourSpace.Ictcp` | `.Ictcp` |
| J<sub>z</sub>a<sub>z</sub>b<sub>z</sub> | `ColourSpace.Jzazbz` | `.Jzazbz` |
Expand Down Expand Up @@ -199,7 +203,7 @@ flowchart TD
HSB(HSB / HSV)
HSL(HSL)
HWB(HWB)
CMYK(CMYK)
HSI(HSI)
XYY(xyY)
XYZ(XYZ)
LAB(LAB)
Expand All @@ -214,6 +218,8 @@ flowchart TD
YUV("YUV (PAL)")
YIQ("YIQ (NTSC)")
YDBDR("YDbDr (SECAM)")
TSL(TSL)
XYB(XYB)
IPT(IPT)
ICTCP(ICtCp)
JZAZBZ(JzAzBz)
Expand All @@ -228,20 +234,23 @@ flowchart TD
CAM16(CAM16)
CAM16UCS(CAM16-UCS)
HCT(HCT)
CMYK(CMYK)
RGB -.-> CMYK
XYZ --> RGBLIN
RGBLIN --> RGB
RGB --> HSB
HSB --> HSL
HSB --> HWB
RGB --> HSI
RGB --> YPBPR
YPBPR --> YCBCR
RGB --> YCGCO
RGB --> YUV
YUV --> YIQ
YUV --> YDBDR
RGB --> TSL
RGBLIN --> XYB
XYZ --> XYY
XYZ --> LAB
LAB --> LCHAB
Expand Down Expand Up @@ -457,6 +466,58 @@ Defines the RGB model, often used to specify a wider gamut than standard RGB (sR
| SECAM&nbsp;(Rec.&nbsp;470) | `.Secam` |
| SECAM&nbsp;625&nbsp;(Rec.&nbsp;1700) | `.Secam625` |

<details>
<summary>Diagram of RGB configurations</summary>

```mermaid
mindmap
root(RGB)
("R 0.64 0.33<br>G 0.30 0.60<br>B 0.15 0.06")
("D65")
("sRGB")
("Rec. 709")
("xvYCC")
("R 0.680 0.320<br>G 0.265 0.690<br>B 0.150 0.060")
("D65")
("Display P3")
("R 0.708 0.292<br>G 0.170 0.797<br>B 0.131 0.046")
("D65")
("Rec. 2020")
("R 0.64 0.33<br>G 0.21 0.71<br>B 0.15 0.06")
("D65")
("A98 RGB")
("R 0.734699 0.265301<br>G 0.159597 0.840403<br>B 0.036598 0.000105")
("D50")
("ProPhoto RGB")
("R 0.7347 0.2653<br>G 0.0000 1.0000<br>B 0.0001 -0.0770")
("W 0.32168 0.33767")
("ACES 2065-1")
("R 0.713 0.293<br>G 0.165 0.830<br>B 0.128 0.044")
("W 0.32168 0.33767")
("ACEScg")
("ACEScct")
("ACEScc")
("R 0.64 0.33<br>G 0.29 0.60<br>B 0.15 0.06")
("D65")
("Rec. 601 (625-line)")
("PAL (Rec. 470)")
("PAL 625 (Rec. 1700)")
("SECAM (Rec. 470)")
("SECAM 625 (Rec. 1700)")
("R 0.67 0.33<br>G 0.21 0.71<br>B 0.14 0.08")
("C")
("PAL-M (Rec. 470)")
("NTSC (Rec. 470)")
("R 0.630 0.340<br>G 0.310 0.595<br>B 0.155 0.070")
("C")
("PAL 525 (Rec. 1700)")
("D65")
("Rec. 601 (525-line)")
("NTSC (SMPTE-C)")
("NTSC 525 (Rec. 1700)")
```
</details>

- Parameters
- Red, green, and blue chromaticity coordinates
- Reference white point
Expand Down Expand Up @@ -513,12 +574,12 @@ All colour spaces are impacted by the reference white point.
Unicolour applies different reference white points to different sets of colour spaces, as shown in the table below.
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 using the Bradford method.

| White&nbsp;point&nbsp;configuration | Affected&nbsp;colour&nbsp;spaces |
|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `RgbConfiguration` | RGB · Linear&nbsp;RGB · HSB&nbsp;/&nbsp;HSV · HSL · HWB · YPbPr · YCbCr&nbsp;/&nbsp;YUV&nbsp;_(digital)_ · YCgCo · YUV&nbsp;_(PAL)_ · YIQ&nbsp;_(NTSC)_ · YDbDr&nbsp;_(SECAM)_ |
| `XyzConfiguration` | CIEXYZ · CIExyY · CIELAB · CIELCh<sub>ab</sub> · CIELUV · CIELCh<sub>uv</sub> · HSLuv · HPLuv |
| `CamConfiguration` | CIECAM02 · CAM16 |
| None (always D65/2°) | 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> · Oklab · Oklch · Okhsv · Okhsl · Okhwb · HCT |
| White&nbsp;point&nbsp;configuration | Affected&nbsp;colour&nbsp;spaces |
|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `RgbConfiguration` | RGB · Linear&nbsp;RGB · HSB&nbsp;/&nbsp;HSV · HSL · HWB · HSI · YPbPr · YCbCr&nbsp;/&nbsp;YUV&nbsp;_(digital)_ · YCgCo · YUV&nbsp;_(PAL)_ · YIQ&nbsp;_(NTSC)_ · YDbDr&nbsp;_(SECAM)_ · TSL · XYB |
| `XyzConfiguration` | CIEXYZ · CIExyY · CIELAB · CIELCh<sub>ab</sub> · CIELUV · CIELCh<sub>uv</sub> · HSLuv · HPLuv |
| `CamConfiguration` | CIECAM02 · CAM16 |
| None (always D65/2°) | 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> · Oklab · Oklch · Okhsv · Okhsl · Okhwb · HCT |

### Convert between configurations
A `Unicolour` can be converted to a different configuration,
Expand Down
Binary file modified Unicolour.Readme/docs/console-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Unicolour.Readme/docs/gradient-spaces.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Unicolour.Readme/docs/gradient-vision-deficiency.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Unicolour.Readme/docs/heatmaps-sun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 63f1fb6

Please sign in to comment.