color-name-list 11.24.0 → 11.24.2

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.
Files changed (40) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +2 -2
  3. package/changes.svg +3 -3
  4. package/dist/colornames.bestof.csv +9 -1
  5. package/dist/colornames.bestof.esm.js +1 -1
  6. package/dist/colornames.bestof.esm.mjs +1 -1
  7. package/dist/colornames.bestof.html +1 -1
  8. package/dist/colornames.bestof.json +1 -1
  9. package/dist/colornames.bestof.min.json +1 -1
  10. package/dist/colornames.bestof.scss +1 -1
  11. package/dist/colornames.bestof.umd.js +1 -1
  12. package/dist/colornames.bestof.xml +33 -1
  13. package/dist/colornames.bestof.yaml +25 -1
  14. package/dist/colornames.csv +12 -11
  15. package/dist/colornames.esm.js +1 -1
  16. package/dist/colornames.esm.mjs +1 -1
  17. package/dist/colornames.html +1 -1
  18. package/dist/colornames.json +1 -1
  19. package/dist/colornames.min.json +1 -1
  20. package/dist/colornames.scss +1 -1
  21. package/dist/colornames.short.csv +7 -1
  22. package/dist/colornames.short.esm.js +1 -1
  23. package/dist/colornames.short.esm.mjs +1 -1
  24. package/dist/colornames.short.html +1 -1
  25. package/dist/colornames.short.json +1 -1
  26. package/dist/colornames.short.min.json +1 -1
  27. package/dist/colornames.short.scss +1 -1
  28. package/dist/colornames.short.umd.js +1 -1
  29. package/dist/colornames.short.xml +25 -1
  30. package/dist/colornames.short.yaml +19 -1
  31. package/dist/colornames.umd.js +1 -1
  32. package/dist/colornames.xml +45 -41
  33. package/dist/colornames.yaml +34 -31
  34. package/dist/history.json +1 -1
  35. package/package.json +4 -3
  36. package/scripts/build.js +43 -36
  37. package/scripts/sortSrc.js +16 -10
  38. package/src/colornames.csv +13 -12
  39. package/tea.yaml +14 -2
  40. package/tests/sorting.test.js +45 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "color-name-list",
3
- "version": "11.24.0",
3
+ "version": "11.24.2",
4
4
  "description": "long list of color names",
5
5
  "main": "dist/colornames.json",
6
6
  "browser": "dist/colornames.umd.js",
@@ -24,9 +24,10 @@
24
24
  "scripts": {
25
25
  "commit": "git-cz",
26
26
  "pull-colors": "curl -L 'https://docs.google.com/spreadsheets/d/e/2PACX-1vQube6Y0wHyEtJnjg0eU3N7VseoxVnD4L9uDqvWZdl_tzzrHDVN10IPP7cdFipX8j70atNMLfPCB0Q6/pub?gid=40578722&single=true&output=csv' -o src/colornames.csv",
27
- "test": "npm run test:precommit && npm run build && vitest run",
27
+ "test": "npm run test:precommit && vitest run",
28
28
  "test:watch": "vitest",
29
- "test:precommit": "npm run build --testonly",
29
+ "test:precommit": "npm run build:test",
30
+ "build:test": "node scripts/build.js --testonly",
30
31
  "build": "node scripts/build.js && npm run prettier",
31
32
  "prettier": "prettier --write ./dist/*",
32
33
  "lint": "npm run lint:scripts && npm run lint:markdown",
package/scripts/build.js CHANGED
@@ -4,7 +4,8 @@ import { parseCSVString, findDuplicates, objArrToString } from './lib.js';
4
4
  import { exec } from 'child_process';
5
5
 
6
6
  const args = process.argv;
7
- const isTestRun = !!args.find((arg) => arg === '--testOnly');
7
+ // treat --testonly / --testOnly the same
8
+ const isTestRun = args.some((arg) => arg.toLowerCase() === '--testonly');
8
9
 
9
10
  // only hex colors with 6 values
10
11
  const hexColorValidation = /^#[0-9a-f]{6}$/;
@@ -88,10 +89,10 @@ colorsSrc.values[bestOfKey].forEach((str) => {
88
89
  });
89
90
 
90
91
  showLog();
91
-
92
+ // In test mode we still perform the build so tests can import dist artifacts,
93
+ // but we avoid mutating repository files like README.md or generating the SVG.
92
94
  if (isTestRun) {
93
- console.log(' See test results above ');
94
- process.exit();
95
+ console.log('Test mode: skipping README & SVG generation.');
95
96
  }
96
97
 
97
98
  // creates JS related files
@@ -336,37 +337,41 @@ for (const outputFormat in outputFormats) {
336
337
  }
337
338
  }
338
339
 
339
- // updates the color count in readme file
340
- const readme = fs.readFileSync(path.normalize(`${baseFolder}${readmeFileName}`), 'utf8').toString();
341
- fs.writeFileSync(
342
- path.normalize(`${baseFolder}${readmeFileName}`),
343
- readme
344
- .replace(
345
- // update color count in text
346
- /__\d+__/g,
347
- `__${colorsSrc.entries.length}__`
348
- )
349
- .replace(
350
- // update color count in badge
351
- /\d+-colors-orange/,
352
- `${colorsSrc.entries.length}-colors-orange`
353
- )
354
- .replace(
355
- // update color count in percentage
356
- /__\d+(\.\d+)?%__/,
357
- `__${((colorsSrc.entries.length / (256 * 256 * 256)) * 100).toFixed(2)}%__`
358
- )
359
- .replace(
360
- // update file size
361
- /\d+(\.\d+)? MB\)__/g,
362
- `${(
363
- fs.statSync(path.normalize(`${baseFolder}${folderDist}${fileNameSrc}.json`)).size /
364
- 1024 /
365
- 1024
366
- ).toFixed(2)} MB)__`
367
- ),
368
- 'utf8'
369
- );
340
+ if (!isTestRun) {
341
+ // updates the color count in readme file
342
+ const readme = fs
343
+ .readFileSync(path.normalize(`${baseFolder}${readmeFileName}`), 'utf8')
344
+ .toString();
345
+ fs.writeFileSync(
346
+ path.normalize(`${baseFolder}${readmeFileName}`),
347
+ readme
348
+ .replace(
349
+ // update color count in text
350
+ /__\d+__/g,
351
+ `__${colorsSrc.entries.length}__`
352
+ )
353
+ .replace(
354
+ // update color count in badge
355
+ /\d+-colors-orange/,
356
+ `${colorsSrc.entries.length}-colors-orange`
357
+ )
358
+ .replace(
359
+ // update color count in percentage
360
+ /__\d+(\.\d+)?%__/,
361
+ `__${((colorsSrc.entries.length / (256 * 256 * 256)) * 100).toFixed(2)}%__`
362
+ )
363
+ .replace(
364
+ // update file size
365
+ /\d+(\.\d+)? MB\)__/, // no global to only hit first occurrence
366
+ `${(
367
+ fs.statSync(path.normalize(`${baseFolder}${folderDist}${fileNameSrc}.json`)).size /
368
+ 1024 /
369
+ 1024
370
+ ).toFixed(2)} MB)__`
371
+ ),
372
+ 'utf8'
373
+ );
374
+ }
370
375
 
371
376
  /**
372
377
  * outputs the collected logs
@@ -479,4 +484,6 @@ function diffSVG() {
479
484
  );
480
485
  }
481
486
 
482
- diffSVG();
487
+ if (!isTestRun) {
488
+ diffSVG();
489
+ }
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * Script to sort the colornames.csv file alphabetically by name
5
- * This helps maintain order when new colors are added to the list
6
- */
4
+ * Script to sort the colornames.csv file alphabetically by name
5
+ * This helps maintain order when new colors are added to the list
6
+ */
7
7
 
8
8
  import fs from 'fs';
9
9
  import path from 'path';
@@ -18,11 +18,17 @@ const csvPath = path.join(__dirname, '..', 'src', 'colornames.csv');
18
18
  // Read the CSV file
19
19
  const readAndSortCSV = () => {
20
20
  try {
21
- // Read the file
22
- const data = fs.readFileSync(csvPath, 'utf8');
21
+ // Read file & normalise line endings to LF
22
+ const raw = fs.readFileSync(csvPath, 'utf8').replace(/\r\n?/g, '\n');
23
23
 
24
- // Split the data into lines
25
- const lines = data.trim().split('\n');
24
+ // Split (keeping possible last empty line which we'll drop below)
25
+ let lines = raw.split('\n');
26
+
27
+ // Drop trailing empty / whitespace-only lines
28
+ while (lines.length && !lines[lines.length - 1].trim()) lines.pop();
29
+
30
+ // Trim trailing whitespace on each line
31
+ lines = lines.map(l => l.replace(/\s+$/,''));
26
32
 
27
33
  // The header should be kept as the first line
28
34
  const header = lines[0];
@@ -38,10 +44,10 @@ const readAndSortCSV = () => {
38
44
  return nameA.localeCompare(nameB);
39
45
  });
40
46
 
41
- // Combine the header and sorted lines
42
- const sortedData = [header, ...sortedColorLines].join('\n');
47
+ // Combine header & sorted lines (no blank line). Ensure exactly one final newline.
48
+ const sortedData = [header, ...sortedColorLines].join('\n') + '\n';
43
49
 
44
- // Write the sorted data back to the file
50
+ // Write back
45
51
  fs.writeFileSync(csvPath, sortedData, 'utf8');
46
52
 
47
53
  console.log(`✅ Successfully sorted ${sortedColorLines.length} colors alphabetically by name`);
@@ -2605,7 +2605,6 @@ Black Garnet,#4e4444,
2605
2605
  Black Glaze,#001111,
2606
2606
  Black Green,#384e49,
2607
2607
  Black Grey,#24272e,
2608
- Black Halo,#201b20,
2609
2608
  Black Haze,#e0ded7,
2610
2609
  Black Headed Gull,#9c856c,
2611
2610
  Black Heath,#6d6150,
@@ -2858,7 +2857,6 @@ Bloodletter,#e97451,
2858
2857
  Bloodline,#882200,
2859
2858
  Bloodmyst Isle,#f02723,
2860
2859
  Bloodsport,#b52f3a,x
2861
- Bloodstain,#772200,
2862
2860
  Bloodstone,#413431,
2863
2861
  Bloodthirsty,#880011,x
2864
2862
  Bloodthirsty Beige,#f8d7d0,x
@@ -3722,7 +3720,6 @@ Bright Nori,#2d5e22,
3722
3720
  Bright Ocarina,#f0e8da,
3723
3721
  Bright Olive,#9cbb04,
3724
3722
  Bright Orange,#ff7034,
3725
- Bright Pink,#fe01b1,
3726
3723
  Bright Purple,#be03fd,
3727
3724
  Bright Red,#ff000d,
3728
3725
  Bright Rose,#c51959,
@@ -3760,7 +3757,6 @@ Brilliant Green,#88b407,
3760
3757
  Brilliant Impression,#efc600,
3761
3758
  Brilliant Lavender,#f4bbff,
3762
3759
  Brilliant Liquorice,#545454,
3763
- Brilliant Rose,#fe54a3,
3764
3760
  Brilliant Sea,#009cb7,
3765
3761
  Brilliant Silver,#a9b0b4,
3766
3762
  Brilliant Turquoise,#00a68b,
@@ -3839,11 +3835,9 @@ Brooklyn,#586766,
3839
3835
  Brookside,#5a7562,
3840
3836
  Brookview,#99b792,
3841
3837
  Broom,#eecc24,x
3842
- Broom Butterfly Blue,#6bb3db,
3843
3838
  Broomstick,#74462d,
3844
3839
  Brother Blue,#b0b7c6,
3845
3840
  Brown,#653700,x
3846
- Brown 383,#443724,
3847
3841
  Brown Alpaca,#b86d29,x
3848
3842
  Brown Bag,#deac6e,
3849
3843
  Brown Bear,#4a3f37,
@@ -3948,10 +3942,9 @@ Bubble Algae,#90e4c1,
3948
3942
  Bubble Bath,#e8e0e9,
3949
3943
  Bubble Bobble Green,#00b800,
3950
3944
  Bubble Bobble P2,#0084ff,
3951
- Bubble Gum,#ff85ff,x
3952
3945
  Bubble Shell,#d3a49a,
3953
3946
  Bubble Turquoise,#43817a,
3954
- Bubblegum,#e76178,
3947
+ Bubblegum,#ff85ff,x
3955
3948
  Bubblegum Baby Girl,#cc55ee,x
3956
3949
  Bubblegum Bright,#ff01b7,
3957
3950
  Bubblegum Crisis,#eeccee,x
@@ -4059,6 +4052,7 @@ Burgundy Grey,#dadba0,
4059
4052
  Burgundy Snail,#7e7150,
4060
4053
  Burgundy Wine,#6c403e,
4061
4054
  Buried Gold,#dbbc4b,x
4055
+ Buried Lust,#772200,x
4062
4056
  Buried Treasure,#d28b42,
4063
4057
  Burj Khalifa Fountain,#d4dee8,
4064
4058
  Burka Black,#353e4f,
@@ -4521,7 +4515,6 @@ Cannon Ball,#484335,
4521
4515
  Cannon Barrel,#3c4142,
4522
4516
  Cannon Black,#251706,
4523
4517
  Cannon Grey,#646c64,
4524
- Cannon Pink,#8e5164,
4525
4518
  Canoe,#ddc49e,
4526
4519
  Canoe Blue,#1d5671,
4527
4520
  Canola Oil,#f7eb7a,
@@ -4573,7 +4566,7 @@ Cape Lee,#50818b,
4573
4566
  Cape Palliser,#75482f,
4574
4567
  Cape Pond,#0092ad,
4575
4568
  Cape Storm,#3c4754,
4576
- Cape Verde,#01554f,
4569
+ Cape Verde,#01554f,x
4577
4570
  Capella,#d9ced2,
4578
4571
  Caper,#afc182,
4579
4572
  Caper Green,#847640,
@@ -4635,11 +4628,9 @@ Caramel Drizzle,#d9ad7f,x
4635
4628
  Caramel Finish,#ffd59a,x
4636
4629
  Caramel Gold,#b1936d,x
4637
4630
  Caramel Ice,#eec9aa,
4638
- Caramel Infused,#cc7755,
4639
4631
  Caramel Kiss,#b08a61,
4640
4632
  Caramel Latte,#8c6342,
4641
4633
  Caramel Macchiato,#c58d4b,x
4642
- Caramel Milk,#ddc283,
4643
4634
  Caramel Mousse,#e5caa4,x
4644
4635
  Caramel Powder,#eebb99,
4645
4636
  Caramel Sauce,#b3804d,
@@ -5293,6 +5284,7 @@ Cherry Red,#f7022a,
5293
5284
  Cherry Sangria,#c92435,x
5294
5285
  Cherry Shine,#d81d26,
5295
5286
  Cherry Soda,#ff0044,x
5287
+ Cherry Static,#e76178,x
5296
5288
  Cherry Tart,#933d3e,
5297
5289
  Cherry Tomato,#f2013f,x
5298
5290
  Cherry Tree,#dfb7b4,
@@ -15538,6 +15530,7 @@ Lizard Legs,#7f6944,
15538
15530
  Llama Wool,#917864,
15539
15531
  Llilacquered,#c35b99,x
15540
15532
  Loafer,#dbd9c2,
15533
+ Loam,#443724,
15541
15534
  Lobaria Lichen,#9fc8b2,
15542
15535
  Lobby Lilac,#a780b2,
15543
15536
  Lobelia,#7498be,
@@ -16929,6 +16922,7 @@ Milky Green,#c6d4c9,
16929
16922
  Milky Lavender,#aea3d0,
16930
16923
  Milky Maize,#f9d9a0,
16931
16924
  Milky Skies,#c3b1af,
16925
+ Milky Waves,#6bb3db,x
16932
16926
  Milky Way,#e8f4f7,
16933
16927
  Milky Way Galaxy,#faefd5,
16934
16928
  Milky Yellow,#f8dd74,
@@ -18175,6 +18169,7 @@ Nick’s Nook,#909062,
18175
18169
  Nickel,#929292,x
18176
18170
  Nickel Ore Green,#537e7e,
18177
18171
  Nickel Plate,#c1c6bf,
18172
+ Nicotine Glaze,#cc7755,
18178
18173
  Nicotine Gold,#eebb33,x
18179
18174
  Niebla Azul,#b6c3c4,
18180
18175
  Nifty Turquoise,#019187,
@@ -18185,6 +18180,7 @@ Night Blue,#040348,
18185
18180
  Night Brown,#44281b,
18186
18181
  Night Brown Black,#322d25,
18187
18182
  Night Club,#494b4e,
18183
+ Night Demons,#201b20,x
18188
18184
  Night Dive,#003355,
18189
18185
  Night Edition,#20586d,x
18190
18186
  Night Flight,#434d5c,
@@ -20442,6 +20438,7 @@ Pink Heath,#f2bddf,
20442
20438
  Pink Hibiscus,#b36c86,
20443
20439
  Pink Horror,#90305d,x
20444
20440
  Pink Hydrangea,#f8c1bb,
20441
+ Pink Hysteria,#fe01b1,x
20445
20442
  Pink Ice,#cf9fa9,
20446
20443
  Pink Icing,#eea0a6,
20447
20444
  Pink Illusion,#d8b8f8,
@@ -20564,6 +20561,7 @@ Pink-N-Purple,#866180,
20564
20561
  Pinkadelic,#cb5c5b,
20565
20562
  Pinkalicious,#ff99ff,x
20566
20563
  Pinkathon,#f1bdba,
20564
+ Pinkella,#fe54a3,
20567
20565
  Pinkham,#e8c5ae,
20568
20566
  Pinkinity,#e82a8e,
20569
20567
  Pinkish,#d46a7e,
@@ -25317,6 +25315,7 @@ Sovereign Red,#ce243f,x
25317
25315
  Sovereignty,#304e63,
25318
25316
  Soviet Gold,#ffd900,x
25319
25317
  Soy Milk,#d5d2c7,x
25318
+ Soy Sauce,#1a0600,
25320
25319
  Soya,#fae3bc,
25321
25320
  Soya Bean,#6f634b,
25322
25321
  Soybean,#cab68b,
@@ -26478,6 +26477,7 @@ Sunshine Surprise,#fcb02f,
26478
26477
  Sunshine Yellow,#fffd37,
26479
26478
  Sunshone Plum,#886688,x
26480
26479
  Sunspark,#fbca69,
26480
+ Sunspill,#ddc283,x
26481
26481
  Sunstitch,#fee2b2,
26482
26482
  Sunstone,#c7887f,
26483
26483
  Suntan,#d9b19f,
@@ -28422,6 +28422,7 @@ Veiling Waterfalls,#d4eaff,x
28422
28422
  Velddrif,#a17d61,
28423
28423
  Vellum Parchment,#efe4d9,
28424
28424
  Velour,#baa7bf,
28425
+ Velour Scar,#8e5164,x
28425
28426
  Veltliner White,#d7d8c3,
28426
28427
  Velum Smoke,#d6ceb9,
28427
28428
  Velvet,#750851,x
package/tea.yaml CHANGED
@@ -1,6 +1,18 @@
1
1
  # https://tea.xyz/what-is-this-file
2
+ #
3
+ # DO NOT REMOVE OR EDIT THIS WARNING:
4
+ #
5
+ # This file is auto-generated by the TEA app. It is intended to validate ownership of your repository.
6
+ # DO NOT commit this file or accept any PR if you don't know what this is.
7
+ # We are aware that spammers will try to use this file to try to profit off others' work.
8
+ # We take this very seriously and will take action against any malicious actors.
9
+ #
10
+ # If you are not the owner of this repository, and someone maliciously opens a commit with this file
11
+ # please report it to us at support@tea.xyz.
12
+ #
13
+ # A constitution without this header is invalid.
2
14
  ---
3
- version: 1.0.0
15
+ version: 2.0.0
4
16
  codeOwners:
5
- - '0xFA64435d1281921E36b90CeA9a1fbf0e5c408e65'
17
+ - '0x2220923A4190a1A2FEE4545Ad86c15998c58C15B'
6
18
  quorum: 1
@@ -0,0 +1,45 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+
5
+ /**
6
+ * Ensures that the source CSV file is already sorted alphabetically (case-insensitive)
7
+ * by the color name. If not, it throws with a helpful message telling how to fix it.
8
+ */
9
+ describe('Source CSV sorting', () => {
10
+ it('colornames.csv should be sorted by name (case-insensitive)', () => {
11
+ const csvPath = path.resolve('./src/colornames.csv');
12
+ const raw = fs.readFileSync(csvPath, 'utf8').replace(/\r\n/g, '\n').trimEnd();
13
+ const lines = raw.split('\n');
14
+ expect(lines.length).toBeGreaterThan(1);
15
+
16
+ const header = lines.shift();
17
+ expect(header.startsWith('name,hex')).toBe(true);
18
+
19
+ const entries = lines
20
+ .filter((l) => l.trim().length)
21
+ .map((l, idx) => {
22
+ const [name, hex] = l.split(',');
23
+ return { originalIndex: idx + 2, line: l, name, lower: name.toLowerCase(), hex };
24
+ });
25
+
26
+ for (let i = 1; i < entries.length; i++) {
27
+ const prev = entries[i - 1];
28
+ const curr = entries[i];
29
+ if (prev.lower.localeCompare(curr.lower) > 0) {
30
+ throw new Error(
31
+ [
32
+ 'Source file src/colornames.csv is not sorted alphabetically by name.',
33
+ `Out of order around lines ${prev.originalIndex} -> ${curr.originalIndex}:`,
34
+ ` "${prev.name}" should come AFTER "${curr.name}"`,
35
+ '',
36
+ 'To fix automatically run:',
37
+ ' npm run sort-colors',
38
+ '',
39
+ 'Commit the updated src/colornames.csv after sorting.'
40
+ ].join('\n')
41
+ );
42
+ }
43
+ }
44
+ });
45
+ });