color-name-list 11.10.1 → 11.11.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/.github/workflows/linting.yml +2 -2
- package/.husky/pre-commit +2 -0
- package/CODE_OF_CONDUCT.md +1 -1
- package/README.md +67 -56
- package/changes.svg +1 -1
- package/dist/colornames.csv +1 -0
- 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.umd.js +1 -1
- package/dist/colornames.xml +4 -0
- package/dist/colornames.yaml +3 -0
- package/dist/history.json +1 -1
- package/package.json +7 -3
- package/scripts/sortSrc.js +57 -0
- package/src/colornames.csv +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "color-name-list",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.11.0",
|
|
4
4
|
"description": "long list of color names",
|
|
5
5
|
"main": "dist/colornames.json",
|
|
6
6
|
"browser": "dist/colornames.umd.js",
|
|
@@ -28,11 +28,14 @@
|
|
|
28
28
|
"test:watch": "vitest",
|
|
29
29
|
"build": "node scripts/build.js && npm run prettier",
|
|
30
30
|
"prettier": "prettier --write ./dist/*",
|
|
31
|
-
"lint": "
|
|
31
|
+
"lint": "npm run lint:scripts && npm run lint:markdown",
|
|
32
|
+
"lint:scripts": "eslint ./scripts",
|
|
33
|
+
"lint:markdown": "markdownlint-cli2 '**/*.md' '#node_modules'",
|
|
32
34
|
"semantic-release": "semantic-release",
|
|
33
35
|
"build-history": "node scripts/tools/history.js > dist/history.json",
|
|
34
36
|
"history": "node scripts/tools/history.js > dist/history.json",
|
|
35
|
-
"prepare": "husky"
|
|
37
|
+
"prepare": "husky",
|
|
38
|
+
"sort-colors": "node scripts/sortSrc.js"
|
|
36
39
|
},
|
|
37
40
|
"repository": {
|
|
38
41
|
"type": "git",
|
|
@@ -64,6 +67,7 @@
|
|
|
64
67
|
"eslint-plugin-prettier": "^5.2.6",
|
|
65
68
|
"globals": "^16.0.0",
|
|
66
69
|
"husky": "^9.1.6",
|
|
70
|
+
"markdownlint-cli2": "^0.17.2",
|
|
67
71
|
"prettier": "^3.5.3",
|
|
68
72
|
"seedrandom": "^3.0.5",
|
|
69
73
|
"semantic-release": "^24.2.0",
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
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
|
+
*/
|
|
7
|
+
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
|
|
12
|
+
// Get the directory name using ES modules approach
|
|
13
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
|
|
15
|
+
// Path to the CSV file
|
|
16
|
+
const csvPath = path.join(__dirname, '..', 'src', 'colornames.csv');
|
|
17
|
+
|
|
18
|
+
// Read the CSV file
|
|
19
|
+
const readAndSortCSV = () => {
|
|
20
|
+
try {
|
|
21
|
+
// Read the file
|
|
22
|
+
const data = fs.readFileSync(csvPath, 'utf8');
|
|
23
|
+
|
|
24
|
+
// Split the data into lines
|
|
25
|
+
const lines = data.trim().split('\n');
|
|
26
|
+
|
|
27
|
+
// The header should be kept as the first line
|
|
28
|
+
const header = lines[0];
|
|
29
|
+
|
|
30
|
+
// Remove the header from the array of lines
|
|
31
|
+
const colorLines = lines.slice(1);
|
|
32
|
+
|
|
33
|
+
// Sort the color lines alphabetically by name (case-insensitive)
|
|
34
|
+
const sortedColorLines = colorLines.sort((a, b) => {
|
|
35
|
+
// Extract the name from each line (first column before the comma)
|
|
36
|
+
const nameA = a.split(',')[0].toLowerCase();
|
|
37
|
+
const nameB = b.split(',')[0].toLowerCase();
|
|
38
|
+
return nameA.localeCompare(nameB);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Combine the header and sorted lines
|
|
42
|
+
const sortedData = [header, ...sortedColorLines].join('\n');
|
|
43
|
+
|
|
44
|
+
// Write the sorted data back to the file
|
|
45
|
+
fs.writeFileSync(csvPath, sortedData, 'utf8');
|
|
46
|
+
|
|
47
|
+
console.log(`✅ Successfully sorted ${sortedColorLines.length} colors alphabetically by name`);
|
|
48
|
+
console.log(`📝 File saved: ${csvPath}`);
|
|
49
|
+
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error('❌ Error sorting the CSV file:', error);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Execute the function
|
|
57
|
+
readAndSortCSV();
|
package/src/colornames.csv
CHANGED
|
@@ -17445,6 +17445,7 @@ Morro Bay,#546b78,
|
|
|
17445
17445
|
Morrow White,#fcfccf,
|
|
17446
17446
|
Mortar,#565051,
|
|
17447
17447
|
Mortar Grey,#9e9f9e,
|
|
17448
|
+
MoS₂ Cyan,#00e6d3,
|
|
17448
17449
|
Mosaic Blue,#007c94,
|
|
17449
17450
|
Mosaic Green,#599f68,
|
|
17450
17451
|
Mosaic Tile,#1c6b69,
|