Skip to content

Commit

Permalink
Update Travis logo, Reduce some duplication (badges#3047)
Browse files Browse the repository at this point in the history
Switch Travis to use full-color logo approved at badges#1276 (comment)
  • Loading branch information
RedSparr0w authored and paulmelnikow committed Feb 22, 2019
1 parent 41fc3bb commit f550f0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions lib/logos.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ function decodeDataUrlFromQueryParam(value) {
}

function getShieldsIcon({ name, color }) {
const key = name.toLowerCase()

if (!(key in logos)) {
if (!(name in logos)) {
return undefined
}

const { svg, base64, isMonochrome } = logos[key]
const { svg, base64, isMonochrome } = logos[name]
const svgColor = toSvgColor(color)
if (svgColor && isMonochrome) {
return svg2base64(svg.replace(/fill="(.+?)"/g, `fill="${svgColor}"`))
Expand Down Expand Up @@ -91,10 +89,7 @@ function getSimpleIconStyle({ icon, style }) {
}

function getSimpleIcon({ name, color, style }) {
let key = name.toLowerCase().replace(/ /g, '-')
if (key in logoAliases) {
key = logoAliases[key]
}
const key = name.replace(/ /g, '-')

if (!(key in simpleIcons)) {
return undefined
Expand All @@ -116,6 +111,12 @@ function prepareNamedLogo({ name, color, style }) {
return undefined
}

name = name.toLowerCase()

if (name in logoAliases) {
name = logoAliases[name]
}

return (
getShieldsIcon({ name, color }) || getSimpleIcon({ name, color, style })
)
Expand Down
Loading

0 comments on commit f550f0c

Please sign in to comment.