Skip to content

Commit

Permalink
Merge branch 'nord' into 'main'
Browse files Browse the repository at this point in the history
Add Nord dataset

See merge request Wacton/Unicolour!66
  • Loading branch information
waacton committed Aug 1, 2024
2 parents c712142 + 7c79abe commit a95b7b7
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ Commonly used sets of colours:
- [CSS specification](https://www.w3.org/TR/css-color-4/#named-colors) named colours
- [xkcd](https://xkcd.com/color/rgb/) colour survey results
- [Macbeth ColorChecker](https://en.wikipedia.org/wiki/ColorChecker) colour rendition chart
- [Nord](https://www.nordtheme.com/) theme colours

Perceptually uniform colourmaps / palettes:
- [Viridis, Plasma, Inferno & Magma](https://bids.github.io/colormap/) (sequential)
Expand Down
35 changes: 35 additions & 0 deletions Unicolour.Datasets/Nord.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace Wacton.Unicolour.Datasets;

// https://www.nordtheme.com/
public static class Nord
{
private static readonly Configuration Config = new(RgbConfiguration.StandardRgb, XyzConfiguration.D65);

public static readonly Unicolour Nord0 = new(Config, "#2e3440");
public static readonly Unicolour Nord1 = new(Config, "#3b4252");
public static readonly Unicolour Nord2 = new(Config, "#434c5e");
public static readonly Unicolour Nord3 = new(Config, "#4c566a");
public static readonly Unicolour Nord4 = new(Config, "#d8dee9");
public static readonly Unicolour Nord5 = new(Config, "#e5e9f0");
public static readonly Unicolour Nord6 = new(Config, "#eceff4");
public static readonly Unicolour Nord7 = new(Config, "#8fbcbb");
public static readonly Unicolour Nord8 = new(Config, "#88c0d0");
public static readonly Unicolour Nord9 = new(Config, "#81a1c1");
public static readonly Unicolour Nord10 = new(Config, "#5e81ac");
public static readonly Unicolour Nord11 = new(Config, "#bf616a");
public static readonly Unicolour Nord12 = new(Config, "#d08770");
public static readonly Unicolour Nord13 = new(Config, "#ebcb8b");
public static readonly Unicolour Nord14 = new(Config, "#a3be8c");
public static readonly Unicolour Nord15 = new(Config, "#b48ead");

public static readonly List<Unicolour> PolarNight = new() { Nord0, Nord1, Nord2, Nord3 };
public static readonly List<Unicolour> SnowStorm = new() { Nord4, Nord5, Nord6 };
public static readonly List<Unicolour> Frost = new() { Nord7, Nord8, Nord9, Nord10 };
public static readonly List<Unicolour> Aurora = new() { Nord11, Nord12, Nord13, Nord14, Nord15 };

public static IEnumerable<Unicolour> All => new List<Unicolour>()
.Concat(PolarNight)
.Concat(SnowStorm)
.Concat(Frost)
.Concat(Aurora);
}
2 changes: 1 addition & 1 deletion Unicolour.Datasets/Unicolour.Datasets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageIcon>Resources\Unicolour.Datasets.png</PackageIcon>
<RepositoryUrl>https://github.com/waacton/Unicolour</RepositoryUrl>
<PackageTags>unicolour colour color colour-data color-data colour-dataset color-dataset colormap colormaps colourmap colourmaps</PackageTags>
<PackageReleaseNotes>Support YbrConfiguration</PackageReleaseNotes>
<PackageReleaseNotes>Add Nord dataset</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions Unicolour.Readme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ Commonly used sets of colours:
- [CSS specification](https://www.w3.org/TR/css-color-4/#named-colors) named colours
- [xkcd](https://xkcd.com/color/rgb/) colour survey results
- [Macbeth ColorChecker](https://en.wikipedia.org/wiki/ColorChecker) colour rendition chart
- [Nord](https://www.nordtheme.com/) theme colours

Perceptually uniform colourmaps / palettes:
- [Viridis, Plasma, Inferno & Magma](https://bids.github.io/colormap/) (sequential)
Expand Down
39 changes: 39 additions & 0 deletions Unicolour.Tests/DatasetNordTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Linq;
using NUnit.Framework;
using Wacton.Unicolour.Datasets;

namespace Wacton.Unicolour.Tests;

public class DatasetNordTests
{
private static readonly Unicolour[] nord = Nord.All.ToArray();

[TestCase(0, "#2e3440")]
[TestCase(1, "#3b4252")]
[TestCase(2, "#434c5e")]
[TestCase(3, "#4c566a")]
[TestCase(4, "#d8dee9")]
[TestCase(5, "#e5e9f0")]
[TestCase(6, "#eceff4")]
[TestCase(7, "#8fbcbb")]
[TestCase(8, "#88c0d0")]
[TestCase(9, "#81a1c1")]
[TestCase(10, "#5e81ac")]
[TestCase(11, "#bf616a")]
[TestCase(12, "#d08770")]
[TestCase(13, "#ebcb8b")]
[TestCase(14, "#a3be8c")]
[TestCase(15, "#b48ead")]
public void ByIndex(int index, string expected)
{
var colour = nord[index];
Assert.That(colour.Hex.ToLower(), Is.EqualTo(expected.ToLower()));
}

[Test]
public void All()
{
Assert.That(Nord.All.Count(), Is.EqualTo(16));
Assert.That(Nord.All.Distinct().Count(), Is.EqualTo(16));
}
}
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ Commonly used sets of colours:
- [CSS specification](https://www.w3.org/TR/css-color-4/#named-colors) named colours
- [xkcd](https://xkcd.com/color/rgb/) colour survey results
- [Macbeth ColorChecker](https://en.wikipedia.org/wiki/ColorChecker) colour rendition chart
- [Nord](https://www.nordtheme.com/) theme colours
Perceptually uniform colourmaps / palettes:
- [Viridis, Plasma, Inferno & Magma](https://bids.github.io/colormap/) (sequential)
Expand Down
1 change: 1 addition & 0 deletions docs/README_us.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ Commonly used sets of colors:
- [CSS specification](https://www.w3.org/TR/css-color-4/#named-colors) named colors
- [xkcd](https://xkcd.com/color/rgb/) color survey results
- [Macbeth ColorChecker](https://en.wikipedia.org/wiki/ColorChecker) color rendition chart
- [Nord](https://www.nordtheme.com/) theme colors
Perceptually uniform colormaps / palettes:
- [Viridis, Plasma, Inferno & Magma](https://bids.github.io/colormap/) (sequential)
Expand Down

0 comments on commit a95b7b7

Please sign in to comment.