color-name-list 13.41.1 → 14.0.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 +2 -2
- package/changes.svg +3 -3
- package/dist/colornames.bestof.csv +55 -53
- package/dist/colornames.bestof.esm.js +1 -1
- package/dist/colornames.bestof.esm.mjs +1 -1
- package/dist/colornames.bestof.html +1 -1
- package/dist/colornames.bestof.json +1 -1
- package/dist/colornames.bestof.min.json +1 -1
- package/dist/colornames.bestof.scss +1 -1
- package/dist/colornames.bestof.toon +56 -54
- package/dist/colornames.bestof.umd.js +1 -1
- package/dist/colornames.bestof.xml +94 -86
- package/dist/colornames.bestof.yaml +82 -76
- package/dist/colornames.csv +214 -234
- package/dist/colornames.esm.js +1 -1
- package/dist/colornames.esm.mjs +1 -1
- package/dist/colornames.html +1 -1
- package/dist/colornames.json +1 -1
- package/dist/colornames.min.json +1 -1
- package/dist/colornames.scss +1 -1
- package/dist/colornames.short.csv +23 -24
- package/dist/colornames.short.esm.js +1 -1
- package/dist/colornames.short.esm.mjs +1 -1
- package/dist/colornames.short.html +1 -1
- package/dist/colornames.short.json +1 -1
- package/dist/colornames.short.min.json +1 -1
- package/dist/colornames.short.scss +1 -1
- package/dist/colornames.short.toon +24 -25
- package/dist/colornames.short.umd.js +1 -1
- package/dist/colornames.short.xml +50 -54
- package/dist/colornames.short.yaml +42 -45
- package/dist/colornames.toon +215 -235
- package/dist/colornames.umd.js +1 -1
- package/dist/colornames.xml +400 -480
- package/dist/colornames.yaml +344 -404
- package/dist/history.json +1 -1
- package/package.json +1 -1
- package/scripts/fix-british-spellings.cjs +86 -0
- package/src/colornames.csv +216 -236
- package/tests/british-spelling-allowlist.json +16 -0
- package/tests/british-spelling.test.js +141 -0
package/package.json
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const csvPath = path.join(__dirname, '../src/colornames.csv');
|
|
5
|
+
let csvContent = fs.readFileSync(csvPath, 'utf8');
|
|
6
|
+
const lines = csvContent.split('\n');
|
|
7
|
+
|
|
8
|
+
// Patterns from tests/british-spelling.test.js
|
|
9
|
+
const americanToBritishPatterns = [
|
|
10
|
+
[/\b(\w*)(arb|arm|behavi|col|enam|endeav|fav|ferv|flav|glam|harb|hon|hum|lab|neighb|od|parl|rum|sav|splend|val|vap|vig)or(ed|ing|y|ful|less|able|er|ist|hood|ite|al|ly|s)?\b/gi, '$1$2our$3'],
|
|
11
|
+
[/\b(\w*)(agon|appet|apolog|author|capital|caramel|categor|character|colon|critic|crystall|emphas|energ|equal|fantas|fertil|final|fossil|legal|maxim|memor|mesmer|minim|mobil|modern|normal|optim|organ|paraly|popular|priorit|real|recogn|stabil|standard|summar|symbol|synchron|tantal|terror|util|vandal|vapor|visual|vulcan)iz(e|ed|es|ing|er|ation|able)\b/gi, '$1$2is$3'],
|
|
12
|
+
[/\b(calib|cent|epicent|fib|goit|lit|lust|meag|met|nit|och|reconnoit|sab|scept|sepulch|somb|spect|theat|tit)er\b/gi, '$1re'],
|
|
13
|
+
[/\b(maneuver)\b/gi, 'manoeuvre'],
|
|
14
|
+
[/\b(mit)er\b/gi, '$1re'],
|
|
15
|
+
[/\b(def|off|pret|lic)ense\b/gi, '$1ence'],
|
|
16
|
+
[/\b(anal|catal|dial|monol|prol)og\b/gi, '$1ogue'],
|
|
17
|
+
[/\b(\w*)(bevel|cancel|carol|channel|fuel|label|level|model|panel|signal|travel)(ed|ing)\b/gi, '$1$2l$3'],
|
|
18
|
+
[/\bgray(\w*)\b/gi, 'grey$1'],
|
|
19
|
+
[/\b(A|a)irplane(\w*)\b/g, '$1eroplane$2'],
|
|
20
|
+
[/\b(A|a)lmanac\b/g, '$1lmanack'],
|
|
21
|
+
[/\b(A|a)rcheolog(\w*)\b/g, '$1rchaeolog$2'],
|
|
22
|
+
[/\b(A|a)rtifact(\w*)\b/g, '$1rtefact$2'],
|
|
23
|
+
[/\b(B|b)ougainvillea\b/g, '$1ougainvillaea'],
|
|
24
|
+
[/\b(C|c)heckered\b/g, '$1hequered'],
|
|
25
|
+
[/\b(C|c)hili\b/g, '$1hilli'],
|
|
26
|
+
[/\b(C|c)himera\b/g, '$1himaera'],
|
|
27
|
+
[/\b(C|c)ozy\b/g, '$1osy'],
|
|
28
|
+
[/\b(D|d)isk\b/g, '$1isc'],
|
|
29
|
+
[/\b(D|d)onut(\w*)\b/g, '$1oughnut$2'],
|
|
30
|
+
[/\b(D|d)raft(\w*)\b/g, '$1raught$2'],
|
|
31
|
+
[/\b(E|e)on\b/g, '$1eon'],
|
|
32
|
+
[/\b(G|g)riffin\b/g, '$1ryphon'],
|
|
33
|
+
[/\b(H|h)emoglobin\b/g, '$1aemoglobin'],
|
|
34
|
+
[/\b(H|h)omeopath(\w*)\b/g, '$1omoeopath$2'],
|
|
35
|
+
[/\b(J|j)ewelry\b/g, '$1ewellery'],
|
|
36
|
+
[/\b(M|m)arvelous\b/g, '$1arvellous'],
|
|
37
|
+
[/\b(M|m)edieval\b/g, '$1ediaeval'],
|
|
38
|
+
[/\b(M|m)old(y|er)?\b/g, '$1ould$2'],
|
|
39
|
+
[/\b(M|m)ustache\b/g, '$1oustache'],
|
|
40
|
+
[/\b(P|p)ajamas\b/g, '$1yjamas'],
|
|
41
|
+
[/\b(P|p)low(\w*)\b/g, '$1lough$2'],
|
|
42
|
+
[/\b(M|m)olt(?!en)(\w*)\b/g, '$1oult$2'],
|
|
43
|
+
[/\b(S|s)keptic(\w*)\b/g, '$1ceptic$2'],
|
|
44
|
+
[/\b(S|s)molder(\w*)\b/g, '$1moulder$2'],
|
|
45
|
+
[/\b(S|s)ulfur(\w*)\b/g, '$1ulphur$2'],
|
|
46
|
+
[/\b(T|t)ranquility\b/g, '$1ranquillity'],
|
|
47
|
+
[/\b(W|w)ool(en|y)\b/g, '$1ooll$2'],
|
|
48
|
+
[/\b(Y|y)ogurt\b/g, '$1oghurt'],
|
|
49
|
+
[/\b(A|a)luminum\b/g, '$1luminium'],
|
|
50
|
+
[/\b(A|a)ging\b/g, '$1geing'],
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
// Load allowlist
|
|
54
|
+
const allowlist = require('../tests/british-spelling-allowlist.json').map(w => w.toLowerCase());
|
|
55
|
+
const allowlistSet = new Set(allowlist);
|
|
56
|
+
|
|
57
|
+
let fixedCount = 0;
|
|
58
|
+
|
|
59
|
+
const newLines = lines.map(line => {
|
|
60
|
+
if (!line.trim()) return line;
|
|
61
|
+
const parts = line.split(',');
|
|
62
|
+
if (parts.length < 2) return line;
|
|
63
|
+
|
|
64
|
+
let name = parts[0]; // Format: name,hex,good name
|
|
65
|
+
const originalName = name;
|
|
66
|
+
|
|
67
|
+
if (allowlistSet.has(name.toLowerCase())) return line;
|
|
68
|
+
|
|
69
|
+
for (const [pattern, replacement] of americanToBritishPatterns) {
|
|
70
|
+
if (name.match(pattern)) {
|
|
71
|
+
// console.log(`Match: ${name} with ${pattern}`);
|
|
72
|
+
name = name.replace(pattern, replacement);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (name !== originalName) {
|
|
77
|
+
fixedCount++;
|
|
78
|
+
console.log(`Fixed: "${originalName}" -> "${name}"`);
|
|
79
|
+
parts[0] = name;
|
|
80
|
+
return parts.join(',');
|
|
81
|
+
}
|
|
82
|
+
return line;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
fs.writeFileSync(csvPath, newLines.join('\n'));
|
|
86
|
+
console.log(`Fixed ${fixedCount} spellings.`);
|