recueil-de-couleur
Advanced tools
Comparing version 0.5.0 to 0.6.0
{ | ||
"name": "recueil-de-couleur", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Liste de noms de couleur en français.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,4 +11,4 @@ # Noms de Couleurs | ||
## List of Color Names 🔖 (**793**) | ||
## List of Color Names 🔖 (**787**) | ||
![Toutes les couleurs](colors.svg "Liste de couleur") |
@@ -142,3 +142,2 @@ import fs from 'fs'; | ||
// data sanitization | ||
@@ -151,7 +150,25 @@ | ||
// sanitize hex values and names | ||
colors.forEach(c => { | ||
// remove parentheses and its contents from name | ||
c.name = c.name.replace(/\(.*\)/, '').trim(); | ||
c.hex = formatHex(c.hex); | ||
if (!c.hex) { | ||
console.wran(`invalid hex: ${c.name} (${c.link})`); | ||
} | ||
}); | ||
// remove duplicate names from colors list | ||
// while keeping the first occurence | ||
colors = colors.filter((c, i) => { | ||
const name = c.name.toLowerCase(); | ||
const index = colors.findIndex(c => c.name.toLowerCase().localeCompare(name) === 0); | ||
const referenceName = c.name.toLowerCase().replace(/-/g, ' ').replace(/Œ/ig, 'oe'); | ||
const index = colors.findIndex( | ||
c => c.name.toLowerCase() | ||
.replace(/-/g, ' ') | ||
.replace(/Œ/ig, 'oe') | ||
.localeCompare( | ||
referenceName | ||
) === 0 | ||
); | ||
if (index === i) { | ||
@@ -172,12 +189,2 @@ return true; | ||
return 0; | ||
}) | ||
// sanitize hex values and names | ||
colors.forEach(c => { | ||
// remove parentheses and its contents from name | ||
c.name = c.name.replace(/\(.*\)/, '').trim(); | ||
c.hex = formatHex(c.hex); | ||
if (!c.hex) { | ||
console.wran(`invalid hex: ${c.name} (${c.link})`); | ||
} | ||
}); | ||
@@ -184,0 +191,0 @@ |
@@ -12,4 +12,9 @@ { | ||
"author": "@meodai" | ||
}, | ||
{ | ||
"name": "flamme rouge", | ||
"hex": "#dd6a2d", | ||
"author": "@meodai" | ||
} | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
392843
4195