color-name-list 11.9.0 → 11.9.1
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/.gitattributes +1 -0
- package/.github/workflows/build.yml +11 -11
- package/.github/workflows/linting.yml +4 -4
- package/.github/workflows/release.yml +1 -1
- package/.github/workflows/updatesponsors.yml +1 -1
- package/.prettierignore +5 -0
- package/.prettierrc.json +7 -0
- package/CODE_OF_CONDUCT.md +10 -10
- package/README.md +21 -21
- package/dist/colornames.bestof.esm.js +4535 -1
- package/dist/colornames.bestof.esm.mjs +4535 -1
- package/dist/colornames.bestof.json +4535 -1
- package/dist/colornames.bestof.scss +4535 -1
- package/dist/colornames.bestof.umd.js +4543 -1
- package/dist/colornames.bestof.yaml +4534 -9067
- package/dist/colornames.esm.js +30292 -1
- package/dist/colornames.esm.mjs +30292 -1
- package/dist/colornames.json +30292 -1
- package/dist/colornames.scss +30292 -1
- package/dist/colornames.short.esm.js +2888 -1
- package/dist/colornames.short.esm.mjs +2888 -1
- package/dist/colornames.short.json +2888 -1
- package/dist/colornames.short.scss +2888 -1
- package/dist/colornames.short.umd.js +2896 -1
- package/dist/colornames.short.yaml +2887 -5773
- package/dist/colornames.umd.js +30300 -1
- package/dist/colornames.yaml +30291 -60581
- package/dist/history.json +61120 -1
- package/eslint.config.js +26 -0
- package/package.json +11 -3
- package/scripts/build.js +86 -99
- package/scripts/lib.js +42 -30
- package/scripts/tools/filterUniques.js +9 -12
- package/scripts/tools/findLargestSpacesInRGB.js +8 -13
- package/scripts/tools/history.js +13 -11
- package/scripts/tools/remapNames.js +2 -4
- package/scripts/tools/shiftColors.js +7 -7
- package/src/colornames.csv +30290 -30290
- package/.eslintrc.json +0 -17
- package/.travis.yml +0 -27
package/scripts/tools/history.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { execSync } from
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
2
|
|
|
3
3
|
function cmd(c) {
|
|
4
|
-
const stdout = execSync(c
|
|
4
|
+
const stdout = execSync(c, {
|
|
5
|
+
maxBuffer: 1024 * 1024 * 100,
|
|
6
|
+
});
|
|
5
7
|
return stdout.toString().trim();
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
// Print the list of colors added/removed/changed by date.
|
|
9
11
|
async function main() {
|
|
10
12
|
// Grab the list of all git commits
|
|
11
|
-
const allCommits = cmd(
|
|
12
|
-
.split(
|
|
13
|
+
const allCommits = cmd('git log --pretty=format:%h --no-merges --follow -- ./src/colornames.csv')
|
|
14
|
+
.split('\n')
|
|
13
15
|
.filter(Boolean);
|
|
14
16
|
|
|
15
17
|
// The data, one element for each commit (date)
|
|
@@ -17,8 +19,8 @@ async function main() {
|
|
|
17
19
|
|
|
18
20
|
for (const commit of allCommits) {
|
|
19
21
|
// Figure out what changed in that particular commit
|
|
20
|
-
const diff = cmd(`git show ${commit} -- ./src/colornames.csv`)
|
|
21
|
-
.split(
|
|
22
|
+
const diff = cmd(`git show --ignore-cr-at-eol ${commit} -- ./src/colornames.csv`)
|
|
23
|
+
.split('\n')
|
|
22
24
|
.filter(Boolean);
|
|
23
25
|
|
|
24
26
|
// Grab the date for said commit
|
|
@@ -34,12 +36,12 @@ async function main() {
|
|
|
34
36
|
}
|
|
35
37
|
const name = res.groups?.name;
|
|
36
38
|
const hex = res.groups?.hex?.trim(); // Remove any \r or whitespace
|
|
37
|
-
|
|
39
|
+
let op = res.groups?.op;
|
|
38
40
|
|
|
39
41
|
// If a value already introduced with a different op, then it's
|
|
40
42
|
// a modification
|
|
41
43
|
if (modified[hex] && modified[hex].op !== op) {
|
|
42
|
-
op =
|
|
44
|
+
op = '~';
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
modified[hex] = { hex, name, op };
|
|
@@ -48,15 +50,15 @@ async function main() {
|
|
|
48
50
|
// Partition by added/removed/changed
|
|
49
51
|
|
|
50
52
|
const added = Object.values(modified)
|
|
51
|
-
.filter((x) => x.op ===
|
|
53
|
+
.filter((x) => x.op === '+')
|
|
52
54
|
.map(({ name, hex }) => ({ name, hex }));
|
|
53
55
|
|
|
54
56
|
const removed = Object.values(modified)
|
|
55
|
-
.filter((x) => x.op ===
|
|
57
|
+
.filter((x) => x.op === '-')
|
|
56
58
|
.map(({ name, hex }) => ({ name, hex }));
|
|
57
59
|
|
|
58
60
|
const changed = Object.values(modified)
|
|
59
|
-
.filter((x) => x.op ===
|
|
61
|
+
.filter((x) => x.op === '~')
|
|
60
62
|
.map(({ name, hex }) => ({ name, hex }));
|
|
61
63
|
|
|
62
64
|
// Add the day only if there were changes
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const colors = fs.readFileSync('colors.csv').toString().split(`\n`);
|
|
3
|
-
const namedColors = JSON.parse(
|
|
4
|
-
fs.readFileSync(__dirname + '/../../dist/colornames.json', 'utf8')
|
|
5
|
-
);
|
|
3
|
+
const namedColors = JSON.parse(fs.readFileSync(__dirname + '/../../dist/colornames.json', 'utf8'));
|
|
6
4
|
const nearestColor = require('../../node_modules/nearest-color/nearestColor.js');
|
|
7
5
|
|
|
8
6
|
// object containing the name:hex pairs for nearestColor()
|
|
@@ -15,7 +13,7 @@ namedColors.forEach((c) => {
|
|
|
15
13
|
const nc = nearestColor.from(colorsObj);
|
|
16
14
|
|
|
17
15
|
const newNames = [];
|
|
18
|
-
colors.forEach(color => {
|
|
16
|
+
colors.forEach((color) => {
|
|
19
17
|
if (!color) return;
|
|
20
18
|
let n = nc(color);
|
|
21
19
|
newNames.push(n.name + ',' + color);
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
// and rexports them as csv
|
|
3
3
|
|
|
4
4
|
const fs = require('fs');
|
|
5
|
-
const tinycolor = require(
|
|
5
|
+
const tinycolor = require('tinycolor2');
|
|
6
6
|
const colors = JSON.parse(fs.readFileSync('someColorList.json').toString());
|
|
7
7
|
|
|
8
8
|
let newColors = [];
|
|
9
9
|
|
|
10
10
|
colors.forEach((col) => {
|
|
11
|
-
const rand = Math.round(
|
|
12
|
-
const lightMod = Math.round(
|
|
11
|
+
const rand = Math.round(4 * Math.random() * (Math.random() < 0.5 ? -1 : 1));
|
|
12
|
+
const lightMod = Math.round(Math.random() * 5);
|
|
13
13
|
let hex;
|
|
14
14
|
|
|
15
15
|
let tinyCol = tinycolor(col.hex).spin(rand);
|
|
16
16
|
|
|
17
|
-
if (tinyCol.isDark()
|
|
17
|
+
if (tinyCol.isDark()) {
|
|
18
18
|
tinyCol.lighten(lightMod);
|
|
19
|
-
}else{
|
|
19
|
+
} else {
|
|
20
20
|
tinyCol.darken(lightMod);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@ colors.forEach((col) => {
|
|
|
24
24
|
|
|
25
25
|
newColors.push({
|
|
26
26
|
name: col.name,
|
|
27
|
-
hex: hex
|
|
27
|
+
hex: hex,
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
console.log(`${col.hex} => ${hex} : ${col.name}`);
|
|
@@ -34,7 +34,7 @@ colors.forEach((col) => {
|
|
|
34
34
|
// create CSV
|
|
35
35
|
let csv = 'name,hex\n';
|
|
36
36
|
|
|
37
|
-
newColors.forEach(col => {
|
|
37
|
+
newColors.forEach((col) => {
|
|
38
38
|
csv += `${col.name},${col.hex}\n`;
|
|
39
39
|
});
|
|
40
40
|
|