diff --git a/doc/logos.md b/doc/logos.md index 8fcbffbfeafc4..ff07f9f014541 100644 --- a/doc/logos.md +++ b/doc/logos.md @@ -4,9 +4,11 @@ ### SimpleIcons -We support a wide range of logos via [SimpleIcons][]. They can be referenced by name e.g: +We support a wide range of logos via [SimpleIcons][]. They should be referenced by the logo slug e.g: -![](https://img.shields.io/npm/v/npm.svg?logo=javascript) - https://img.shields.io/npm/v/npm.svg?logo=javascript +![](https://img.shields.io/npm/v/npm.svg?logo=nodedotjs) - https://img.shields.io/npm/v/npm.svg?logo=nodedotjs + +The set of Simple Icon slugs can be found in the [slugs.md](https://github.com/simple-icons/simple-icons/blob/develop/slugs.md) file in the Simple Icons repository. NB - the Simple Icons site and that slugs.md page may at times contain new icons that haven't yet been pulled into the Shields.io runtime. More information on how and when we incorporate icon updates can be found [here](https://github.com/badges/shields/discussions/5369). ### Shields logos diff --git a/frontend/components/usage.tsx b/frontend/components/usage.tsx index ed4523f1ce8e9..e553780703b8e 100644 --- a/frontend/components/usage.tsx +++ b/frontend/components/usage.tsx @@ -335,10 +335,12 @@ export default function Usage({ baseUrl }: { baseUrl: string }): JSX.Element { > simple-icons - . Simple-icons are referenced using names as they appear on the - simple-icons site. If the name includes spaces, replace them - with dashes (e.g:{' '} - ?logo=visual-studio-code) + . Simple-icons are referenced using icon slugs which can be + found on the simple-icons site or in the + + slugs.md file + {' '} + in the simple-icons repository. } key="logo" diff --git a/lib/load-simple-icons.js b/lib/load-simple-icons.js index 976573d411c10..86f9b8e3563a7 100644 --- a/lib/load-simple-icons.js +++ b/lib/load-simple-icons.js @@ -5,18 +5,37 @@ const { svg2base64 } = require('./svg-helpers') function loadSimpleIcons() { const simpleIcons = {} + // As of v5 the exported keys are the svg slugs + // Historically, Shields has supported logo specification via + // name, name with spaces replaced by hyphens, and partially slugs + // albeit only in cases where the slug happened to match one of those. + // For backwards compatibility purposes we now support all three, but + // do not broadcast the support for by-title references due to our strong + // preference to steer users towards using the actual slugs. + // https://github.com/badges/shields/pull/6591 + // https://github.com/badges/shields/issues/4273 Object.keys(originalSimpleIcons).forEach(key => { - const k = key.toLowerCase().replace(/ /g, '-') - simpleIcons[k] = originalSimpleIcons[key] - simpleIcons[k].base64 = { - default: svg2base64( - simpleIcons[k].svg.replace('