-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for simple-icons, colored icons with ?logoColor (#1810)
* add simple-icons * handle undefined * support logoColor param * our icon > simple-icon * dont crash ✅ * return false → undefined * update test * add test * support logoColor on our logos * cache as base64, pre-load-simple-icons, logo-helper * add ?logoColor information * and simple-icons reference, link to github master branch for our logos * update simple-icons update to 1.7.1 * Revert "and simple-icons reference, link to github master branch for our logos" This reverts commit 5e99d5f. * add link to simple-icons * Add snapshot test * support dash in place of space for logo name
- Loading branch information
1 parent
8020ff0
commit 317e19e
Showing
12 changed files
with
186 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
const simpleIcons = require('simple-icons'); | ||
const { svg2base64 } = require('./logo-helper'); | ||
|
||
function loadSimpleIcons(){ | ||
Object.keys(simpleIcons).forEach(function (key) { | ||
const k = key.toLowerCase().replace(/ /g, '-'); | ||
if (k !== key) { | ||
simpleIcons[k] = simpleIcons[key]; | ||
delete simpleIcons[key]; | ||
} | ||
simpleIcons[k].base64 = svg2base64(simpleIcons[k].svg.replace('<svg', `<svg fill="#${simpleIcons[k].hex}"`)); | ||
}); | ||
return (simpleIcons); | ||
} | ||
|
||
module.exports = loadSimpleIcons; |
Oops, something went wrong.