color-name-list 13.19.2 → 13.19.3

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.
@@ -29989,4 +29989,4 @@
29989
29989
  Zunda Green,#6bc026
29990
29990
  Zuni,#008996
29991
29991
  Zürich Blue,#248bcc
29992
- Zürich White,#e6e1d9
29992
+ Zürich White,#e6e1d9
@@ -119964,4 +119964,4 @@
119964
119964
  <name>Zürich White</name>
119965
119965
  <hex>#e6e1d9</hex>
119966
119966
  </color>
119967
- </colors>
119967
+ </colors>
@@ -89970,4 +89970,4 @@
89970
89970
  hex:"#248bcc"
89971
89971
  -
89972
89972
  name:"Zürich White"
89973
- hex:"#e6e1d9"
89973
+ hex:"#e6e1d9"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "color-name-list",
3
- "version": "13.19.2",
3
+ "version": "13.19.3",
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
@@ -178,12 +178,15 @@ fs.writeFileSync(
178
178
  const outputFormats = {
179
179
  csv: {
180
180
  insertBefore: csvKeys.join(',') + '\n',
181
+ rowDelimitor: '\n',
182
+ insertAfter: '\n',
181
183
  },
182
184
  toon: {
183
185
  // TOON tabular array header for flat objects: [N]{name,hex}:
184
186
  insertBefore: `[${colorsSrc.entries.length}]{${csvKeys.join(',')}}:\n `,
185
187
  itemDelimitor: ',',
186
188
  rowDelimitor: '\n ',
189
+ insertAfter: '\n',
187
190
  },
188
191
  yaml: {
189
192
  insertBefore: '-\n ',
@@ -192,12 +195,13 @@ const outputFormats = {
192
195
  includeKeyPerItem: true,
193
196
  rowDelimitor: '\n-\n ',
194
197
  itemDelimitor: '\n ',
198
+ insertAfter: '\n',
195
199
  },
196
200
  scss: {
197
201
  insertBefore: '$color-name-list: (',
198
202
  beforeValue: '"',
199
203
  afterValue: '"',
200
- insertAfter: ');',
204
+ insertAfter: ');\n',
201
205
  itemDelimitor: ':',
202
206
  rowDelimitor: ',',
203
207
  },
@@ -205,13 +209,13 @@ const outputFormats = {
205
209
  insertBefore: `<table><thead><tr><th>${csvKeys.join('</th><th>')}</th></tr><thead><tbody><tr><td>`,
206
210
  itemDelimitor: '</td><td>',
207
211
  rowDelimitor: '</td></tr><tr><td>',
208
- insertAfter: `</td></tr></tbody></table>`,
212
+ insertAfter: `</td></tr></tbody></table>\n`,
209
213
  },
210
214
  xml: {
211
215
  insertBefore: `<?xml version='1.0'?>\n<colors>\n<color>\n<${csvKeys[0]}>`,
212
216
  itemDelimitor: `</${csvKeys[0]}>\n<${csvKeys[1]}>`,
213
217
  rowDelimitor: `</${csvKeys[1]}>\n</color>\n<color>\n<${csvKeys[0]}>`,
214
- insertAfter: `</${csvKeys[1]}>\n</color>\n</colors>`,
218
+ insertAfter: `</${csvKeys[1]}>\n</color>\n</colors>\n`,
215
219
  },
216
220
  };
217
221
 
@@ -41,11 +41,11 @@ const readAndSortCSV = () => {
41
41
  // Extract the name from each line (first column before the comma)
42
42
  const nameA = a.split(',')[0].toLowerCase();
43
43
  const nameB = b.split(',')[0].toLowerCase();
44
- return nameA.localeCompare(nameB);
44
+ return nameA.localeCompare(nameB, 'en');
45
45
  });
46
46
 
47
47
  // Combine header & sorted lines (no blank line). Ensure exactly one final newline.
48
- const sortedData = [header, ...sortedColorLines].join('\n');
48
+ const sortedData = [header, ...sortedColorLines].join('\n') + '\n';
49
49
 
50
50
  // Write back
51
51
  fs.writeFileSync(csvPath, sortedData, 'utf8');
@@ -30,9 +30,27 @@ describe('CSV Data Validations', () => {
30
30
  });
31
31
 
32
32
  if (invalidHexCodes.length) {
33
- const details = invalidHexCodes.map(
34
- ({ hex, name, lineNumber }) => ` * line ${lineNumber}: "${name}" -> ${hex}`
35
- );
33
+ const details = invalidHexCodes.map(({ hex, name, lineNumber }) => {
34
+ let msg = ` * line ${lineNumber}: "${name}" -> "${hex}"`;
35
+ if (hex.trim() !== hex) {
36
+ msg += ' (contains surrounding whitespace)';
37
+ }
38
+ return msg;
39
+ });
40
+
41
+ const hasWhitespaceIssues = invalidHexCodes.some((i) => i.hex.trim() !== i.hex);
42
+ const tips = [
43
+ 'Edit src/colornames.csv and fix the hex values',
44
+ 'Use lowercase letters only: a-f',
45
+ 'Always use 6 characters: #rrggbb format',
46
+ ];
47
+
48
+ if (hasWhitespaceIssues) {
49
+ tips.push('Remove any leading or trailing spaces around the hex code');
50
+ }
51
+
52
+ tips.push('After changes, run: npm run sort-colors');
53
+
36
54
  throw new Error(
37
55
  buildFailureMessage({
38
56
  title: 'Found {n} invalid hex color {items}:',
@@ -45,12 +63,7 @@ describe('CSV Data Validations', () => {
45
63
  'Examples of valid hex codes: #ff0000, #a1b2c3, #000000',
46
64
  'Examples of invalid hex codes: #f00 (too short), #FF0000 (uppercase), #gghhii (invalid characters)',
47
65
  ],
48
- tips: [
49
- 'Edit src/colornames.csv and fix the hex values',
50
- 'Use lowercase letters only: a-f',
51
- 'Always use 6 characters: #rrggbb format',
52
- 'After changes, run: npm run sort-colors',
53
- ],
66
+ tips,
54
67
  })
55
68
  );
56
69
  }