color-name-list 13.13.1 → 13.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ # C# Usage
2
+
3
+ C# support is provided by
4
+ [vycdev/ColorNamesSharp](https://github.com/vycdev/ColorNamesSharp).
5
+ The library is available as a
6
+ [NuGet package](https://www.nuget.org/packages/ColorNamesSharp).
7
+
8
+ ## Creating the instance
9
+
10
+ ```csharp
11
+ ColorNames colorNames = new ColorNamesBuilder()
12
+ .Add("Best Blue", "#3299fe") // Add your own custom colors
13
+ .LoadDefault() // Load the default color list
14
+ .AddFromCsv("path/to/your/colorlist.csv") // Add a custom color list from a csv file
15
+ .Build(); // Get a new ColorNames instance that includes all the colors you've added
16
+ ```
17
+
18
+ ## Getting a fitting color name
19
+
20
+ ```csharp
21
+ NamedColor customNamedColor = new("Custom Named Color", 50, 153, 254);
22
+
23
+ // You can directly get the name of the color as a string
24
+ string colorNameFromHex = colorNames.FindClosestColorName("#facfea"); // Classic Rose
25
+ string colorNameFromRgb = colorNames.FindClosestColorName(224, 224, 255); // Stoic White
26
+ string colorNameFromNamedColor = colorNames.FindClosestColorName(customNamedColor); // Best Blue
27
+
28
+ // Or similarly you can get the NamedColor object
29
+ NamedColor namedColorFromHex = colorNames.FindClosestColorName("#facfea"); // Classic Rose
30
+ NamedColor namedColorFromRgb = colorNames.FindClosestColorName(224, 224, 255); // Stoic White
31
+ NamedColor namedColorFromNamedColor = colorNames.FindClosestColorName(customNamedColor); // Best Blue
32
+
33
+ // Or a random color
34
+ NamedColor randomColor = colorNames.GetRandomNamedColor();
35
+ ```
36
+
37
+ See the upstream project for more details and updates:
38
+ [vycdev/ColorNamesSharp](https://github.com/vycdev/ColorNamesSharp)
@@ -0,0 +1,58 @@
1
+ # Java / Kotlin Usage
2
+
3
+ Java/Kotlin support is provided by
4
+ [UwUAroze/Color-Names](https://github.com/UwUAroze/Color-Names).
5
+
6
+ ## Gradle (Kotlin DSL)
7
+
8
+ ```kts
9
+ repositories {
10
+ maven("https://jitpack.io")
11
+ }
12
+
13
+ dependencies {
14
+ implementation("me.aroze:color-names:1.0.4")
15
+ }
16
+ ```
17
+
18
+ ## Maven
19
+
20
+ ```xml
21
+ <repository>
22
+ <id>jitpack.io</id>
23
+ <url>https://jitpack.io</url>
24
+ </repository>
25
+
26
+ <dependency>
27
+ <groupId>me.aroze</groupId>
28
+ <artifactId>color-names</artifactId>
29
+ <version>1.0.4</version>
30
+ </dependency>
31
+ ```
32
+
33
+ ## Closest Named Color (Java)
34
+
35
+ ```java
36
+ public ColorNames colorNames = new ColorNameBuilder()
37
+ .loadDefaults()
38
+ .build();
39
+
40
+ String fromHex = colorNames.getName("#facfea"); // "Classic Rose"
41
+ String fromRGB = colorNames.getName(224, 224, 255); // "Stoic White"
42
+ String fromColor = colorNames.getName(new Color(255, 219, 240)); // "Silky Pink"
43
+ ```
44
+
45
+ ## Closest Named Color (Kotlin)
46
+
47
+ ```kt
48
+ val colorNames = ColorNameBuilder()
49
+ .loadDefaults()
50
+ .build()
51
+
52
+ val fromHex = colorNames.getName("#facfea") // "Classic Rose"
53
+ val fromRGB = colorNames.getName(224, 224, 255) // "Stoic White"
54
+ val fromColor = colorNames.getName(Color(255, 219, 240)) // "Silky Pink"
55
+ ```
56
+
57
+ See the upstream project for more details and updates:
58
+ [UwUAroze/Color-Names](https://github.com/UwUAroze/Color-Names)
@@ -0,0 +1,81 @@
1
+ # JavaScript / TypeScript Usage
2
+
3
+ This guide shows how to use the color list from JavaScript and
4
+ TypeScript projects. It covers ESM and CommonJS usage and finding the
5
+ closest named color.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install color-name-list
11
+ ```
12
+
13
+ ## Data Shape
14
+
15
+ ```ts
16
+ type ColorName = { name: string; hex: string };
17
+ ```
18
+
19
+ ## ESM (Node/Browser Bundlers)
20
+
21
+ ```js
22
+ import { colornames } from 'color-name-list';
23
+
24
+ const white = colornames.find((c) => c.hex === '#ffffff');
25
+ console.log(white.name); // => white
26
+
27
+ const eigengrau = colornames.find((c) => c.name === 'Eigengrau');
28
+ console.log(eigengrau?.hex); // => #16161d
29
+ ```
30
+
31
+ ## CommonJS (require)
32
+
33
+ ```js
34
+ // When required, the package returns the array of color objects directly
35
+ const colornames = require('color-name-list');
36
+
37
+ const white = colornames.find((c) => c.hex === '#ffffff');
38
+ console.log(white.name); // => white
39
+ ```
40
+
41
+ ## Find the Closest Named Color
42
+
43
+ With 16,777,216 possible RGB colors, you may want to use a helper like
44
+ `nearest-color` or `ClosestVector`.
45
+
46
+ ```js
47
+ import nearestColor from 'nearest-color';
48
+ import { colornames } from 'color-name-list';
49
+
50
+ // nearestColor expects an object { name => hex }
51
+ const colors = colornames.reduce((o, { name, hex }) => Object.assign(o, { [name]: hex }), {});
52
+ const nearest = nearestColor.from(colors);
53
+
54
+ // Get closest named color
55
+ nearest('#f1c1d1'); // => Fairy Tale
56
+ ```
57
+
58
+ Note: For better visual accuracy, consider DeltaE or using CIECAM02
59
+ instead of raw RGB distance:
60
+
61
+ - [DeltaE](https://github.com/zschuessler/DeltaE)
62
+ - [CIECAM02](https://github.com/baskerville/ciecam02)
63
+
64
+ ## Subsets and Performance Tips
65
+
66
+ - Best-of subset (smaller list):
67
+ - ESM: `import { colornames as bestof } from 'color-name-list/bestof'`
68
+ - UMD: `https://unpkg.com/color-name-list/dist/colornames.bestof.umd.js`
69
+ - Short subset (< 13 characters, best-of filtered): `dist/colornames.short.*`
70
+ - For browsers, prefer the public API for payload-sensitive scenarios:
71
+ [Color Name API](https://github.com/meodai/color-name-api)
72
+
73
+ ## CDN (Reproducible)
74
+
75
+ - Latest: `https://unpkg.com/color-name-list/dist/colornames.min.json`
76
+ - Pinned: `https://unpkg.com/color-name-list@<version>/dist/colornames.min.json`
77
+
78
+ ## Types
79
+
80
+ The package ships ESM. For TypeScript projects, you can declare the data
81
+ shape as shown above or infer it directly from usage.
@@ -0,0 +1,51 @@
1
+ # Rust Usage
2
+
3
+ Rust support is provided by
4
+ [philocalyst/color-names](https://github.com/philocalyst/color-names).
5
+ Add it with:
6
+
7
+ ```sh
8
+ cargo add colorsnamed
9
+ ```
10
+
11
+ ## Choosing colors
12
+
13
+ ```rust
14
+ use colorsnamed;
15
+
16
+ let black = colorsnamed::Basic::Black;
17
+ let teal = colorsnamed::Basic::Teal;
18
+ let another = colorsnamed::Xkcd::Tea;
19
+ ```
20
+
21
+ ## Getting colors
22
+
23
+ ```rust
24
+ use colorsnamed;
25
+
26
+ // Get the relevant hex code
27
+ let red = colorsnamed::Basic::Red;
28
+ let hex = red.hex();
29
+
30
+ // Figure out if there is a matching color for a hex code!
31
+ let ex: colorsnamed::Basic = hex.try_into().unwrap();
32
+ ```
33
+
34
+ ## Converting colors
35
+
36
+ ```rust
37
+ use colorsnamed;
38
+ use colors;
39
+ use rgb::Rgb;
40
+
41
+ // Convert to the representation of your colorspace of choice.
42
+ let correct_color = red.color::<colors::Srgb>();
43
+
44
+ let red = colorsnamed::Basic::Red;
45
+
46
+ // Get the RGB representation
47
+ let rgb: Rgb = red.rgb();
48
+ ```
49
+
50
+ See the upstream project for more details and updates:
51
+ [philocalyst/color-names](https://github.com/philocalyst/color-names)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "color-name-list",
3
- "version": "13.13.1",
3
+ "version": "13.15.0",
4
4
  "description": "long list of color names",
5
5
  "main": "dist/colornames.json",
6
6
  "browser": "dist/colornames.umd.js",
@@ -9239,6 +9239,7 @@ Fall Mood,#c2ac9b,
9239
9239
  Fall River,#f59344,
9240
9240
  Fall Straw,#fee3c5,
9241
9241
  Fallen Blossoms,#edb2c4,x
9242
+ Fallen Canopy,#b85824,x
9242
9243
  Fallen Leaves,#917347,
9243
9244
  Fallen Petals,#f2e0da,x
9244
9245
  Fallen Rock,#8b8072,
@@ -15752,7 +15753,7 @@ Magic Spell,#544f66,
15752
15753
  Magic Wand,#c3d9e4,
15753
15754
  Magic Whale,#17034a,
15754
15755
  Magical,#c1ceda,
15755
- Magical Malachite,#22cc88,
15756
+ Magical Malachite,#22cc88,x
15756
15757
  Magical Mauve,#baa3a9,
15757
15758
  Magical Melon,#e9e9d0,
15758
15759
  Magical Merlin,#3d8ed0,x
@@ -16383,6 +16384,7 @@ Mellow Flower,#f1dfe9,
16383
16384
  Mellow Glow,#ffcfad,
16384
16385
  Mellow Green,#d5d593,
16385
16386
  Mellow Mango,#cc4400,x
16387
+ Mellow Marrow,#e8c2b4,x
16386
16388
  Mellow Mauve,#9c6579,
16387
16389
  Mellow Melon,#ee2266,x
16388
16390
  Mellow Mint,#ddedbd,x