Fix #294
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 920 B After Width: | Height: | Size: 920 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
753
manifest.json
|
@ -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": {
|
||||
|
|
|
@ -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()
|
||||
};
|
||||
});
|
||||
|
||||
|
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |