color-name-list 13.19.0 → 13.19.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 (44) hide show
  1. package/CONTRIBUTING.md +3 -0
  2. package/README.md +71 -50
  3. package/changes.svg +3 -3
  4. package/dist/colornames.bestof.csv +40 -31
  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.toon +41 -32
  12. package/dist/colornames.bestof.umd.js +1 -1
  13. package/dist/colornames.bestof.xml +67 -31
  14. package/dist/colornames.bestof.yaml +58 -31
  15. package/dist/colornames.csv +120 -127
  16. package/dist/colornames.esm.js +1 -1
  17. package/dist/colornames.esm.mjs +1 -1
  18. package/dist/colornames.html +1 -1
  19. package/dist/colornames.json +1 -1
  20. package/dist/colornames.min.json +1 -1
  21. package/dist/colornames.scss +1 -1
  22. package/dist/colornames.short.csv +8 -8
  23. package/dist/colornames.short.esm.js +1 -1
  24. package/dist/colornames.short.esm.mjs +1 -1
  25. package/dist/colornames.short.html +1 -1
  26. package/dist/colornames.short.json +1 -1
  27. package/dist/colornames.short.min.json +1 -1
  28. package/dist/colornames.short.scss +1 -1
  29. package/dist/colornames.short.toon +9 -9
  30. package/dist/colornames.short.umd.js +1 -1
  31. package/dist/colornames.short.xml +8 -8
  32. package/dist/colornames.short.yaml +8 -8
  33. package/dist/colornames.toon +121 -128
  34. package/dist/colornames.umd.js +1 -1
  35. package/dist/colornames.xml +141 -169
  36. package/dist/colornames.yaml +134 -155
  37. package/dist/history.json +1 -1
  38. package/package.json +1 -1
  39. package/scripts/build.js +2 -2
  40. package/scripts/lib.js +27 -2
  41. package/src/colornames.csv +120 -127
  42. package/tests/duplicates.test.js +65 -0
  43. package/tests/title-case-allowlist.json +46 -0
  44. package/tests/title-case.test.js +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "color-name-list",
3
- "version": "13.19.0",
3
+ "version": "13.19.2",
4
4
  "description": "long list of color names",
5
5
  "main": "dist/colornames.json",
6
6
  "browser": "dist/colornames.umd.js",
package/scripts/build.js CHANGED
@@ -295,8 +295,8 @@ fs.writeFileSync(
295
295
  )
296
296
  .replace(
297
297
  // update file size (update all occurrences)
298
- /\d+(\.\d+)? MB\)__+/g,
299
- `${(
298
+ /Bundle size note \(≈?\d+(\.\d+)? MB\)__/g,
299
+ `Bundle size note (${(
300
300
  fs.statSync(path.normalize(`${baseFolder}${folderDist}${fileNameSrc}.json`)).size /
301
301
  1024 /
302
302
  1024
package/scripts/lib.js CHANGED
@@ -153,15 +153,40 @@ export const findNearDuplicateNameConflicts = (items, options = {}) => {
153
153
  )
154
154
  : null;
155
155
 
156
+ // Note: We intentionally do NOT fold business/legal suffixes globally here,
157
+ // as the dataset contains legitimate color names like "Limited Lime".
158
+
156
159
  // Helper: normalize name using current options (stopword folding if enabled)
157
160
  const normalizeForOptions = (name) => {
158
- const base = String(name)
161
+ // Pre-pass: normalize symbols/abbreviations before tokenization
162
+ let base = String(name)
159
163
  .toLowerCase()
160
164
  .normalize('NFD')
161
165
  .replace(/[\u0300-\u036f]/g, '');
166
+ // Symbolic swaps
167
+ base = base
168
+ .replace(/@/g, ' at ')
169
+ .replace(/[&+]/g, ' and ')
170
+ .replace(/\bw\/o\b/g, ' without ')
171
+ .replace(/\bw\//g, ' with ');
172
+ // Keep marketing spellings (lite/thru/nite) as-is globally to avoid over-merging
162
173
  const tokens = base.match(/[a-z0-9]+/g) || [];
174
+
175
+ // Conjunction normalization: treat variants of "and" as the same token.
176
+ // This includes: "and", "n", "n'", "n`", "&", "+" (after stripping punctuation).
177
+ const normalizedTokens = tokens.map((t) => {
178
+ const raw = t.replace(/[`']/g, '');
179
+ if (raw === 'and' || raw === 'n') return 'and';
180
+ if (raw === '2') return 'to';
181
+ if (raw === '4') return 'for';
182
+ if (raw === 'u') return 'you';
183
+ if (raw === 'r') return 'are';
184
+ return raw;
185
+ });
163
186
  const filtered =
164
- foldStopwords && stopSet && stopSet.size ? tokens.filter((t) => !stopSet.has(t)) : tokens;
187
+ foldStopwords && stopSet && stopSet.size
188
+ ? normalizedTokens.filter((t) => !stopSet.has(t))
189
+ : normalizedTokens;
165
190
  return filtered.length ? filtered.join('') : normalizeNameForDuplicates(name);
166
191
  };
167
192