Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update simple-icons names #3641

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions lib/load-simple-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,34 @@ const simpleIcons = require('simple-icons')
const { svg2base64 } = require('./svg-helpers')

function loadSimpleIcons() {
// Apply other key bindings
Object.keys(simpleIcons).forEach(key => {
const k = key.toLowerCase().replace(/ /g, '-')
if (k !== key) {
simpleIcons[k] = simpleIcons[key]
const _key = key
.toLowerCase()
.replace(/ /g, '-')
.replace(/[^\-.a-z0-9]/gi, '')
if (key !== _key) {
simpleIcons[_key] = simpleIcons[key]
delete simpleIcons[key]
key = _key
}
simpleIcons[k].base64 = {

simpleIcons[key].base64 = {
default: svg2base64(
simpleIcons[k].svg.replace('<svg', `<svg fill="#${simpleIcons[k].hex}"`)
simpleIcons[key].svg.replace(
'<svg',
`<svg fill="#${simpleIcons[key].hex}"`
)
),
light: svg2base64(
simpleIcons[k].svg.replace('<svg', `<svg fill="whitesmoke"`)
simpleIcons[key].svg.replace('<svg', `<svg fill="whitesmoke"`)
),
dark: svg2base64(
simpleIcons[key].svg.replace('<svg', `<svg fill="#333"`)
),
dark: svg2base64(simpleIcons[k].svg.replace('<svg', `<svg fill="#333"`)),
}
})

return simpleIcons
}

Expand Down
2 changes: 1 addition & 1 deletion lib/logos.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function getSimpleIconStyle({ icon, style }) {
}

function getSimpleIcon({ name, color, style }) {
const key = name.replace(/ /g, '-')
const key = name.replace(/ /g, '-').replace(/[^\-.a-z0-9]/gi, '')

if (!(key in simpleIcons)) {
return undefined
Expand Down