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.
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  [![npm](https://img.shields.io/npm/dt/color-name-list.svg)](https://www.npmjs.com/package/color-name-list)
14
14
  [![github sponsor count](https://img.shields.io/github/sponsors/meodai)](https://github.com/sponsors/meodai)
15
15
 
16
- A meticulously curated collection of __29985__ unique color names, sourced from
16
+ A meticulously curated collection of __29987__ unique color names, sourced from
17
17
  [various references](#sources-) and thousands of thoughtful user contributions.
18
18
 
19
19
  > The names of color function like a thread attached to a frightfully slender
@@ -27,7 +27,6 @@ A meticulously curated collection of __29985__ unique color names, sourced from
27
27
  | <a href="#usage-">Usage</a>
28
28
  | <a href="#cdn-">CDN</a>
29
29
  | <a href="#api-">Public Rest API</a>
30
- | <a href="#usage-js-">Usage JS/Java/Kotlin/C#</a>
31
30
  | <a href="#sources-">Name Sources</a>
32
31
  | <a href="#latest-color-names-">Latest Color Names</a>
33
32
  | <a href="#costs--sponsors">Sponsors</a>
@@ -75,7 +74,7 @@ CI notes:
75
74
  - No need to run `npm run build` locally; CI generates outputs.
76
75
  - Optional locally: `npm run lint:markdown` to match CI markdown checks.
77
76
 
78
- ## Color Count: __29985__ πŸŽ‰
77
+ ## Color Count: __29987__ πŸŽ‰
79
78
 
80
79
  ~__0.18%__ of the RGB color space
81
80
 
@@ -91,23 +90,22 @@ color space: [Visualization](https://codepen.io/meodai/full/zdgXJj/)
91
90
 
92
91
  ## Usage πŸ“–
93
92
 
93
+ ### Docs
94
+
95
+ While the tooling and list are primarily in JavaScript/TypeScript, there are several
96
+ other implementations maintained by the community:
97
+
98
+ - JS/TS: [docs/usage-js.md](docs/usage-js.md)
99
+ - Java/Kotlin: [docs/usage-java-kotlin.md](docs/usage-java-kotlin.md)
100
+ - C#: [docs/usage-csharp.md](docs/usage-csharp.md)
101
+ - Rust: [docs/usage-rust.md](docs/usage-rust.md)
102
+
94
103
  ### Consuming the list
95
104
 
96
105
  The list is available in [multiple formats](https://app.unpkg.com/color-name-list/files/dist),
97
106
  or you can use the [public REST API](#api-), making it easy to integrate into
98
107
  your project.
99
108
 
100
- ### Node.js Installation πŸ“¦
101
-
102
- __Size Warning (1.14 MB)__: For browser usage,
103
- consider the [public rest API](#api-)
104
-
105
- ```shell
106
- npm install color-name-list --save
107
- ```
108
-
109
- or `yarn add color-name-list`
110
-
111
109
  ### CDN 🌍
112
110
 
113
111
  #### All Names πŸ“š
@@ -133,6 +131,22 @@ or `yarn add color-name-list`
133
131
  / [SCSS](https://unpkg.com/color-name-list/dist/colornames.bestof.scss)
134
132
  / [CSS](https://unpkg.com/color-name-list/dist/colornames.bestof.css)
135
133
 
134
+ ### Usage JS πŸ“¦
135
+
136
+ __Size Warning (1.14 MB)__: For browser usage,
137
+ consider the [public rest API](#api-).
138
+
139
+ Minimal example:
140
+
141
+ ```javascript
142
+ import { colornames } from 'color-name-list';
143
+
144
+ const white = colornames.find((c) => c.hex === '#ffffff');
145
+ console.log(white?.name); // => white
146
+ ```
147
+
148
+ More examples: see `docs/usage-js.md`.
149
+
136
150
  ### API πŸƒ
137
151
 
138
152
  To simplify access, we provide a free and public REST API for all color names
@@ -153,63 +167,6 @@ generates excessive traffic, you may be asked to become a sponsor.
153
167
  You are welcome to self-host the APIβ€”it's easy to deploy on Heroku and relies
154
168
  only on a few dependencies: [Color-Name-API](https://github.com/meodai/color-name-api)
155
169
 
156
- ### Usage JS ⌨
157
-
158
- __Size Warning (1.14 MB)__: For browser usage,
159
- consider the [public rest API](#api-)
160
-
161
- #### Data Shape
162
-
163
- ```ts
164
- type ColorName = { name: string; hex: string };
165
- ```
166
-
167
- #### Exact Color
168
-
169
- ```javascript
170
- import { colornames } from 'color-name-list';
171
-
172
- let someColor = colornames.find((color) => color.hex === '#ffffff');
173
- console.log(someColor.name); // => white
174
-
175
- let someNamedColor = colornames.find((color) => color.name === 'Eigengrau');
176
- console.log(someColor.hex); // => #16161d
177
- ```
178
-
179
- #### CommonJS
180
-
181
- ```js
182
- // Returns the array directly when using CommonJS
183
- const colornames = require('color-name-list');
184
-
185
- const white = colornames.find((c) => c.hex === '#ffffff');
186
- console.log(white.name); // => white
187
- ```
188
-
189
- #### Closest Named Color
190
-
191
- With 16,777,216 possible RGB colors, you may want to use a library such as
192
- [nearest-color] or [ClosestVector] to find the closest named color.
193
-
194
- ```js
195
- import nearestColor from 'nearest-color';
196
- import { colornames } from 'color-name-list';
197
-
198
- // nearestColor expects an object {name => hex}
199
- const colors = colornames.reduce((o, { name, hex }) => Object.assign(o, { [name]: hex }), {});
200
-
201
- const nearest = nearestColor.from(colors);
202
-
203
- // get closest named color
204
- nearest('#f1c1d1'); // => Fairy Tale
205
- ```
206
-
207
- __Note__: For greater visual accuracy, consider using [DeltaE] or the above
208
- approach with [ciecam02] instead of RGB.
209
-
210
- [DeltaE]: https://github.com/zschuessler/DeltaE
211
- [ciecam02]: https://github.com/baskerville/ciecam02
212
-
213
170
  ### Building πŸ”¨
214
171
 
215
172
  ```shell
@@ -218,145 +175,11 @@ npm install && npm run build
218
175
 
219
176
  See [package.json](package.json#L6) for details.
220
177
 
221
- ### Usage Java/Kotlin ⌨
222
-
223
- Java/Kotlin support is provided by:
224
- [UwUAroze/Color-Names](https://github.com/UwUAroze/Color-Names).
225
- See the repository for more, or use the basics below:
226
-
227
- #### Importing - Gradle.kts
228
-
229
- ```kts
230
- repositories {
231
- maven("https://jitpack.io")
232
- }
233
-
234
- dependencies {
235
- implementation("me.aroze:color-names:1.0.4")
236
- }
237
- ```
238
-
239
- #### Importing - Maven
240
-
241
- ```xml
242
- <repository>
243
- <id>jitpack.io</id>
244
- <url>https://jitpack.io</url>
245
- </repository>
246
-
247
- <dependency>
248
- <groupId>me.aroze</groupId>
249
- <artifactId>color-names</artifactId>
250
- <version>1.0.4</version>
251
- </dependency>
252
- ```
253
-
254
- #### Closest named color - Java
255
-
256
- ```java
257
- public ColorNames colorNames = new ColorNameBuilder()
258
- .loadDefaults()
259
- .build();
260
-
261
- String fromHex = colorNames.getName("#facfea"); // "Classic Rose"
262
- String fromRGB = colorNames.getName(224, 224, 255); // "Stoic White"
263
- String fromColor = colorNames.getName(new Color(255, 219, 240)); // "Silky Pink"
264
- ```
265
-
266
- #### Closest named color - Kotlin
267
-
268
- ```kt
269
- val colorNames = ColorNameBuilder()
270
- .loadDefaults()
271
- .build()
272
-
273
- val fromHex = colorNames.getName("#facfea") // "Classic Rose"
274
- val fromRGB = colorNames.getName(224, 224, 255) // "Stoic White"
275
- val fromColor = colorNames.getName(Color(255, 219, 240)) // "Silky Pink"
276
- ```
277
-
278
- ### Usage C# ⌨
279
-
280
- C# support is provided by:
281
- [vycdev/ColorNamesSharp](https://github.com/vycdev/ColorNamesSharp)
282
- See the repository for more details; basic usage is below:
283
-
284
- The library is available as a [nuget package](https://www.nuget.org/packages/ColorNamesSharp)
285
-
286
- #### Creating the instance
287
-
288
- ```csharp
289
- ColorNames colorNames = new ColorNamesBuilder()
290
- .Add("Best Blue", "#3299fe") // Add your own custom colors
291
- .LoadDefault() // Load the default color list
292
- .AddFromCsv("path/to/your/colorlist.csv") // Add a custom color list from a csv file
293
- .Build(); // Get a new ColorNames instance that includes all the colors you've added
294
- ```
295
-
296
- #### Getting a fitting color name
297
-
298
- ```csharp
299
- NamedColor customNamedColor = new("Custom Named Color", 50, 153, 254);
300
-
301
- // You can directly get the name of the color as a string
302
- string colorNameFromHex = colorNames.FindClosestColorName("#facfea"); // Classic Rose
303
- string colorNameFromRgb = colorNames.FindClosestColorName(224, 224, 255); // Stoic White
304
- string colorNameFromNamedColor = colorNames.FindClosestColorName(customNamedColor); // Best Blue
305
-
306
- // Or similarly you can get the NamedColor object
307
- NamedColor namedColorFromHex = colorNames.FindClosestColorName("#facfea"); // Classic Rose
308
- NamedColor namedColorFromRgb = colorNames.FindClosestColorName(224, 224, 255); // Stoic White
309
- NamedColor namedColorFromNamedColor = colorNames.FindClosestColorName(customNamedColor); // Best Blue
310
-
311
- // Or a random color
312
- NamedColor randomColor = colorNames.GetRandomNamedColor();
313
- ```
314
-
315
- ### Usage Rust
316
-
317
- Rust support is provided by
318
- [philocalyst/color-names](https://github.com/philocalyst/color-names).
319
- You can add it to your rust project with `cargo add colorsnamed`. See the
320
- repository for more details. Basic usage is below.
321
-
322
- #### Choosing colors
323
-
324
- ```rust
325
- use colorsnamed;
326
-
327
- let black = colorsnamed::Basic::Black;
328
- let teal = colorsnamed::Basic::Teal;
329
- let another = colorsnamed::Xkcd::Tea;
330
- ```
331
-
332
- #### Getting colors
333
-
334
- ```rust
335
- use colorsnamed;
336
-
337
- // Get the relevant hex code
338
- let red = colorsnamed::Basic::Red;
339
- let hex = red.hex();
340
-
341
- // Figure out if there is a matching color for a hex code!
342
- let ex: colorsnamed::Basic = hex.try_into().unwrap();
343
- ```
344
-
345
- #### Converting colors
178
+ ### Java/Kotlin, C#, Rust
346
179
 
347
- ```rust
348
- use colorsnamed;
349
- use colors;
350
- use rgb::Rgb;
351
-
352
- // Convert to the represention of your colorspace of choice.
353
- let correct_color = red.color::<colors::Srgb>();
354
-
355
- let red = colorsnamed::Basic::Red;
356
-
357
- // Get the RGB representation
358
- let rgb: Rgb = red.rgb();
359
- ```
180
+ - [docs/usage-java-kotlin.md](docs/usage-java-kotlin.md)
181
+ - [docs/usage-csharp.md](docs/usage-csharp.md)
182
+ - [docs/usage-rust.md](docs/usage-rust.md)
360
183
 
361
184
  ## Sources πŸ—’
362
185
 
@@ -493,11 +316,6 @@ so we can address them promptly.
493
316
  [Color Distribution]: https://codepen.io/meodai/full/zdgXJj/
494
317
  [Twitter Bot]: https://twitter.com/color_parrot
495
318
 
496
- <!-- 3r party libraries & tools -->
497
-
498
- [ClosestVector]: https://github.com/meodai/ClosestVector
499
- [nearest-color]: https://github.com/dtao/nearest-color
500
-
501
319
  <!-- people -->
502
320
 
503
321
  [Ichatdelune]: https://www.reddit.com/user/Ichatdelune
package/changes.svg CHANGED
@@ -1,4 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 570">
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 290">
2
2
  <defs>
3
3
  <style type="text/css">
4
4
  @import url('https://rsms.me/inter/inter.css');
@@ -9,6 +9,6 @@
9
9
  }
10
10
  </style>
11
11
  </defs>
12
- <rect fill="#212121" x="0" y="0" width="600" height="570"/>
13
- <text x="40" y="90" fill="#c8b960">Almond Puff</text><text x="40" y="160" fill="#5f1a10">Altar Wine</text><text x="40" y="230" fill="#83c0e5">Billow</text><text x="40" y="300" fill="#877732">Dragon Well</text><text x="40" y="370" fill="#363e7d">Evening Magic</text><text x="40" y="440" fill="#377b70">Pearl Green</text><text x="40" y="510" fill="#5e0e0b">Sacramental Red</text>
12
+ <rect fill="#212121" x="0" y="0" width="600" height="290"/>
13
+ <text x="40" y="90" fill="#b85824">Fallen Canopy</text><text x="40" y="160" fill="#22cc88">Magical Malachite</text><text x="40" y="230" fill="#e8c2b4">Mellow Marrow</text>
14
14
  </svg>
@@ -1318,6 +1318,7 @@ Fake Jade,#13eac9
1318
1318
  Fake Love,#cc77ee
1319
1319
  Falafel,#aa7711
1320
1320
  Fallen Blossoms,#edb2c4
1321
+ Fallen Canopy,#b85824
1321
1322
  Fallen Petals,#f2e0da
1322
1323
  Fanatic Fuchsia,#ee1199
1323
1324
  Fancy Fuchsia,#ff0088
@@ -2476,6 +2477,7 @@ Magic Carpet,#9488be
2476
2477
  Magic Ink,#0247fe
2477
2478
  Magic Magenta,#7f4774
2478
2479
  Magic Potion,#ff4466
2480
+ Magical Malachite,#22cc88
2479
2481
  Magical Merlin,#3d8ed0
2480
2482
  Magical Moonlight,#f0eeeb
2481
2483
  Magical Stardust,#eaeadb
@@ -2599,6 +2601,7 @@ Mellow Apricot,#f8b878
2599
2601
  Mellow Dandelion,#f8de7f
2600
2602
  Mellow Drama,#ffc65f
2601
2603
  Mellow Mango,#cc4400
2604
+ Mellow Marrow,#e8c2b4
2602
2605
  Mellow Melon,#ee2266
2603
2606
  Mellow Mint,#ddedbd
2604
2607
  Melodramatic Magenta,#dd22aa