This commit is contained in:
Sindre Sorhus 2019-04-17 11:42:51 +07:00
parent df67b9e48e
commit 5a160a8825
7 changed files with 388 additions and 387 deletions

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 920 B

After

Width:  |  Height:  |  Size: 920 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because it is too large Load Diff

View File

@ -45,11 +45,11 @@
"devDependencies": {
"alpha-sort": "^2.0.1",
"coinlist": "^3.0.0",
"get-svg-colors": "^1.5.1",
"globby-cli": "^1.0.1",
"husky": "^1.3.1",
"svgo": "^1.2.0",
"xo": "^0.24.0",
"get-svg-colors": "^1.5.1"
"svgo": "^1.2.2",
"xo": "^0.24.0"
},
"husky": {
"hooks": {

View File

@ -46,19 +46,19 @@ const overrides = new Map([
const icons = manifest.map(icon => {
const id = typeof icon === 'string' ? icon : icon.symbol;
const fileName = `${id.toLowerCase()}.svg`;
const svgPath = path.resolve(__dirname, '../svg/color/', fileName);
let color;
if (fs.existsSync(svgPath)) {
const svg = fs.readFileSync(svgPath, 'utf8');
const fillColor = getColors(svg).fills[0];
color = fillColor ? fillColor.hex().toUpperCase() : undefined;
const filename = `${id.toLowerCase()}.svg`;
const svgPath = path.resolve(__dirname, '../svg/color/', filename);
const svg = fs.readFileSync(svgPath, 'utf8');
const fillColor = getColors(svg).fills[0];
if (!fillColor) {
throw new Error(`Couldn't get color for \`${id}\``);
}
return {
symbol: id.toUpperCase(),
name: overrides.get(id) || coins.get(id, 'name') || id,
color
color: fillColor.hex().toLowerCase()
};
});

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB