color-name-list 10.24.1 → 10.25.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 +3 -3
- package/dist/colornames.csv +0 -5
- 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 +1246 -0
- package/dist/colornames.short.esm.js +1 -0
- package/dist/colornames.short.esm.mjs +1 -0
- package/dist/colornames.short.html +1 -0
- package/dist/colornames.short.json +1 -0
- package/dist/colornames.short.min.json +1 -0
- package/dist/colornames.short.scss +1 -0
- package/dist/colornames.short.umd.js +1 -0
- package/dist/colornames.short.xml +4983 -0
- package/dist/colornames.short.yaml +3735 -0
- package/dist/colornames.umd.js +1 -1
- package/dist/colornames.xml +0 -20
- package/dist/colornames.yaml +0 -15
- package/dist/history.json +1 -1
- package/package.json +1 -1
- package/scripts/build.js +79 -0
- package/src/colornames.csv +0 -5
package/package.json
CHANGED
package/scripts/build.js
CHANGED
|
@@ -26,6 +26,9 @@ const fileNameSrc = 'colornames';
|
|
|
26
26
|
const fileNameBestOfPostfix = '.bestof';
|
|
27
27
|
const readmeFileName = 'README.md';
|
|
28
28
|
|
|
29
|
+
const fileNameShortPostfix = '.short';
|
|
30
|
+
const maxShortNameLength = 12;
|
|
31
|
+
|
|
29
32
|
const sortBy = 'name';
|
|
30
33
|
const csvKeys = ['name', 'hex'];
|
|
31
34
|
const bestOfKey = 'good name';
|
|
@@ -118,6 +121,24 @@ const JSONExportStringBestOf = JSON.stringify(
|
|
|
118
121
|
)
|
|
119
122
|
);
|
|
120
123
|
|
|
124
|
+
const JSONExportStringShort = JSON.stringify(
|
|
125
|
+
[...colorsSrc.entires]
|
|
126
|
+
.filter(
|
|
127
|
+
// make sure its only one word long
|
|
128
|
+
(val) =>
|
|
129
|
+
val[bestOfKey] &&
|
|
130
|
+
val.name.split(" ").length === 1 &&
|
|
131
|
+
val.name.length < maxShortNameLength
|
|
132
|
+
)
|
|
133
|
+
.map(
|
|
134
|
+
// removes good name attributes
|
|
135
|
+
(val) => ({
|
|
136
|
+
name: val.name,
|
|
137
|
+
hex: val.hex,
|
|
138
|
+
})
|
|
139
|
+
)
|
|
140
|
+
);
|
|
141
|
+
|
|
121
142
|
fs.writeFileSync(
|
|
122
143
|
path.normalize(`${baseFolder}${folderDist}${fileNameSrc}.json`),
|
|
123
144
|
JSONExportString
|
|
@@ -128,6 +149,11 @@ fs.writeFileSync(
|
|
|
128
149
|
JSONExportStringBestOf
|
|
129
150
|
);
|
|
130
151
|
|
|
152
|
+
fs.writeFileSync(
|
|
153
|
+
path.normalize(`${baseFolder}${folderDist}${fileNameSrc}${fileNameShortPostfix}.json`),
|
|
154
|
+
JSONExportStringShort
|
|
155
|
+
);
|
|
156
|
+
|
|
131
157
|
// creates a more compact JSON file, where the HEX color serves as an id
|
|
132
158
|
const miniJSONExportObj = colorsSrc.entires.reduce((obj, entry) => {
|
|
133
159
|
obj[entry.hex.replace('#', '')] = entry.name;
|
|
@@ -141,6 +167,17 @@ const miniJSONExportObjBestOf = colorsSrc.entires.reduce((obj, entry) => {
|
|
|
141
167
|
return obj;
|
|
142
168
|
}, {});
|
|
143
169
|
|
|
170
|
+
const miniJSONExportObjShort = colorsSrc.entires.reduce((obj, entry) => {
|
|
171
|
+
if (
|
|
172
|
+
entry[bestOfKey] &&
|
|
173
|
+
entry.name.split(" ").length === 1 &&
|
|
174
|
+
entry.name.length < maxShortNameLength
|
|
175
|
+
) {
|
|
176
|
+
obj[entry.hex.replace("#", "")] = entry.name;
|
|
177
|
+
}
|
|
178
|
+
return obj;
|
|
179
|
+
}, {});
|
|
180
|
+
|
|
144
181
|
fs.writeFileSync(
|
|
145
182
|
path.normalize(`${baseFolder}${folderDist}${fileNameSrc}.min.json`),
|
|
146
183
|
JSON.stringify(miniJSONExportObj)
|
|
@@ -151,6 +188,11 @@ fs.writeFileSync(
|
|
|
151
188
|
JSON.stringify(miniJSONExportObjBestOf)
|
|
152
189
|
);
|
|
153
190
|
|
|
191
|
+
fs.writeFileSync(
|
|
192
|
+
path.normalize(`${baseFolder}${folderDist}${fileNameSrc}${fileNameShortPostfix}.min.json`),
|
|
193
|
+
JSON.stringify(miniJSONExportObjShort)
|
|
194
|
+
);
|
|
195
|
+
|
|
154
196
|
// gets UMD template
|
|
155
197
|
const umdTpl = fs.readFileSync(
|
|
156
198
|
path.normalize(__dirname + '/umd.js.tpl'),
|
|
@@ -168,6 +210,11 @@ fs.writeFileSync(
|
|
|
168
210
|
umdTpl.replace('"{{COLORS}}"', JSONExportStringBestOf)
|
|
169
211
|
);
|
|
170
212
|
|
|
213
|
+
fs.writeFileSync(
|
|
214
|
+
path.normalize(`${baseFolder}${folderDist}${fileNameSrc}${fileNameShortPostfix}.umd.js`),
|
|
215
|
+
umdTpl.replace('"{{COLORS}}"', JSONExportStringShort)
|
|
216
|
+
);
|
|
217
|
+
|
|
171
218
|
// gets ESM template
|
|
172
219
|
const esmTpl = fs.readFileSync(
|
|
173
220
|
path.normalize(__dirname + '/esm.js.tpl'),
|
|
@@ -193,6 +240,15 @@ fs.writeFileSync(
|
|
|
193
240
|
esmTpl.replace('"{{COLORS}}"', JSONExportStringBestOf)
|
|
194
241
|
);
|
|
195
242
|
|
|
243
|
+
fs.writeFileSync(
|
|
244
|
+
path.normalize(`${baseFolder}${folderDist}${fileNameSrc}${fileNameShortPostfix}.esm.js`),
|
|
245
|
+
esmTpl.replace('"{{COLORS}}"', JSONExportStringShort)
|
|
246
|
+
);
|
|
247
|
+
fs.writeFileSync(
|
|
248
|
+
path.normalize(`${baseFolder}${folderDist}${fileNameSrc}${fileNameShortPostfix}.esm.mjs`),
|
|
249
|
+
esmTpl.replace('"{{COLORS}}"', JSONExportStringShort)
|
|
250
|
+
);
|
|
251
|
+
|
|
196
252
|
// create foreign formats
|
|
197
253
|
// configuration for the file outputs
|
|
198
254
|
const outputFormats = {
|
|
@@ -264,6 +320,29 @@ for (const outputFormat in outputFormats) {
|
|
|
264
320
|
}
|
|
265
321
|
}
|
|
266
322
|
|
|
323
|
+
// short files
|
|
324
|
+
for (const outputFormat in outputFormats) {
|
|
325
|
+
if (outputFormats[outputFormat]) {
|
|
326
|
+
let outputString = objArrToString(
|
|
327
|
+
colorsSrc.entires.filter(
|
|
328
|
+
(val) =>
|
|
329
|
+
val[bestOfKey] &&
|
|
330
|
+
val.name.split(" ").length === 1 &&
|
|
331
|
+
val.name.length < maxShortNameLength
|
|
332
|
+
),
|
|
333
|
+
csvKeys,
|
|
334
|
+
outputFormats[outputFormat]
|
|
335
|
+
);
|
|
336
|
+
if (outputFormat === 'html' || outputFormat === 'xml') {
|
|
337
|
+
outputString = outputString.replace(/&/g, '&');
|
|
338
|
+
}
|
|
339
|
+
fs.writeFileSync(
|
|
340
|
+
path.normalize(`${baseFolder}${folderDist}${fileNameSrc}${fileNameShortPostfix}.${outputFormat}`),
|
|
341
|
+
outputString
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
267
346
|
// updates the color count in readme file
|
|
268
347
|
const readme = fs.readFileSync(
|
|
269
348
|
path.normalize(`${baseFolder}${readmeFileName}`),
|
package/src/colornames.csv
CHANGED
|
@@ -2603,7 +2603,6 @@ Black Ice,#4d5051,
|
|
|
2603
2603
|
Black Ink,#44413c,
|
|
2604
2604
|
Black Iris,#2b3042,
|
|
2605
2605
|
Black is Back,#0f1519,
|
|
2606
|
-
Black Is Beautiful,#552222,
|
|
2607
2606
|
Black Jasmine Rice,#74563d,
|
|
2608
2607
|
Black Kite,#351e1c,
|
|
2609
2608
|
Black Knight,#010b13,x
|
|
@@ -3361,9 +3360,6 @@ Bologna Sausage,#ffcfdc,
|
|
|
3361
3360
|
Bolognese,#bb4400,x
|
|
3362
3361
|
Bolt from the Blue,#2277ff,
|
|
3363
3362
|
Boltgun Metal,#393939,
|
|
3364
|
-
Bombay,#aeaead,
|
|
3365
|
-
Bombay Brown,#af6135,
|
|
3366
|
-
Bombay Pink,#c9736a,
|
|
3367
3363
|
Bon Voyage,#8baeb2,
|
|
3368
3364
|
Bona Fide,#304471,
|
|
3369
3365
|
Bona Fide Beige,#cbb9ab,
|
|
@@ -4427,7 +4423,6 @@ Canadian Maple,#cab266,x
|
|
|
4427
4423
|
Canadian Pancake,#edd8c3,
|
|
4428
4424
|
Canadian Pine,#2e7b52,
|
|
4429
4425
|
Canadian Tuxedo,#579aca,x
|
|
4430
|
-
Canadian Voodoo Grey,#b8b7a3,
|
|
4431
4426
|
Canal Blue,#9cc2c5,
|
|
4432
4427
|
Canal Street,#969281,
|
|
4433
4428
|
Canaletto,#818c72,
|