Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

badges

bevry7.4kArtistic-2.04.40.0TypeScript support: included

The definitive collection of badges for rendering

+1, 60devs, badge, badges, bitcoin, boost lab, boostlab, browser, buy me a coffee, buymeacoffee, coveralls, coveralls.io, crypto, david, david dm, deno, deno-edition, deno-entry, denoland, donate, donation, es2022, facebook, facebook follow, facebook like, flattr, follow, github, github follow, github sponsors, github star, give thanks, google plus, google+, gratipay, hacker news, liberapay, like, module, node, nodeico, npm, npm downloads, npm version, open collective, opencollective, patreon, paypal, plus one, quora, quora follow, reddit, sauce labs, saucelabs, shields, shields.io, sixtydevs, slack, slackin, star, thanks app, thanksapp, tip, tips, travis, travis ci, travisci, tweet, twitter, twitter follow, typed, types, typescript, waffle, waffle.io, wishlist

readme

badges

Status of the GitHub Workflow: bevry NPM version NPM downloads
GitHub Sponsors donate button ThanksDev donate button Patreon donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button
Discord server badge Twitch community badge

The definitive collection of badges for rendering

Usage

Complete API Documentation.

import { renderBadges } from 'badges'

// Listing of badges to output
const list = [
    // Custom Badges
    ['badge', { image: 'image', alt: 'alt' }],
    ['badge', { image: 'image', alt: 'alt', url: 'url', title: 'title' }],
    [
        'shields',
        {
            left: 'left',
            right: 'right',
            alt: 'alt',
            url: 'url',
            title: 'title',
        },
    ],
    [
        'shields',
        {
            left: 'left',
            right: 'right',
            color: 'red',
            alt: 'alt',
            url: 'url',
            title: 'title',
        },
    ],
    '---',
    // Development Badges
    'npmversion',
    'npmdownloads',
    'daviddm',
    'daviddmdev',
    'nodeico',
    '---',
    // Testing Badges
    'saucelabsbm',
    'saucelabs',
    'travisci',
    'codeship',
    'coveralls',
    'codeclimate',
    'bithound',
    'waffle',
    '---',
    // Funding Badges
    'sixtydevstips',
    'patreon',
    'opencollective',
    'gratipay',
    'flattr',
    'paypal',
    'bitcoin',
    'wishlist',
    '---',
    // Social Badges
    'slackinscript',
    'slackin',
    'gabeacon',
    'googleplusone',
    'redditsubmit',
    'hackernewssubmit',
    'facebooklike',
    'facebookfollow',
    'twittertweet',
    'twitterfollow',
    'githubfollow',
    'githubstar',
    'quorafollow',
]

// Configuration for the badges
const config = {
    npmPackageName: 'badges',

    saucelabsUsername: 'bevry',
    saucelabsAuthToken: '123',
    codeshipProjectUUID: '123',
    codeshipProjectID: '123',
    githubSlug: 'bevry/badges',
    nodeicoQueryString: { downloads: true, compact: true, height: 2 },

    sixtydevstipsID: 'd2dcf439c9759e88f3ccec1cef394c10',
    patreonUsername: 'bevry',
    opencollectiveUsername: 'bevry',
    gratipayUsername: 'bevry',
    flattrUsername: 'balupton',
    paypalURL: 'https://paypal.me/bevry',
    paypalButtonID: 'QB8GQPZAH84N6', // another option instead of paypalURL
    paypalUsername: 'bevry', // another option instead of paypalURL
    bitcoinURL: 'https://bevry.me/bitcoin',
    wishlistURL: 'https://bevry.me/wishlist',

    slackinURL: 'https://slack.bevry.me',
    gaTrackingID: 'UA-XXXXX-XX',
    homepage: 'https://bevry.me',
    facebookApplicationID: '123123',
    facebookUsername: 'balupton',
    twitterUsername: 'bevryme',
    githubUsername: 'balupton',
    quoraUsername: 'Benjamin-Lupton',
    quoraRealname: 'Benjamin Arthur Lupton', // optional, will extract from username
}

// Options for rendering the badges
const options = {
    // Filter Category
    // When set to a string, will only render badges from the list that of the specified category
    // Values can be 'development', 'testing', 'funding', or 'social'
    // E.g. to render only funding badges, set to 'funding'
    filterCategory: false,

    // Filter Scripts
    // When true, do not render any badges from the list that are scripts
    filterScripts: false,
}

// Render the badges to a string
const result = renderBadges(list, config, options)

// Output the result
console.log(result)

If you want to render badges inside your own project's readme files, check out the meta builder projectz which uses this package for badge rendering.

Not all the badges are showcased in the above example. Browse the Complete API Documentation instead.

Install

npm

  • Install: npm install --save badges
  • Import: import * as pkg from ('badges')
  • Require: const pkg = require('badges')

Deno

import * as pkg from 'https://unpkg.com/badges@^4.40.0/edition-deno/index.ts'

Skypack

<script type="module">
    import * as pkg from '//cdn.skypack.dev/badges@^4.40.0'
</script>

unpkg

<script type="module">
    import * as pkg from '//unpkg.com/badges@^4.40.0'
</script>

jspm

<script type="module">
    import * as pkg from '//dev.jspm.io/badges@4.40.0'
</script>

Editions

This package is published with the following editions:

  • badges/source/index.ts is TypeScript source code with Import for modules
  • badges/edition-browsers/index.js is TypeScript compiled against ES2022 for web browsers with Import for modules
  • badges aliases badges/edition-es2022/index.js
  • badges/edition-es2022/index.js is TypeScript compiled against ES2022 for Node.js 10 || 12 || 14 || 16 || 18 || 20 || 21 with Require for modules
  • badges/edition-es2022-esm/index.js is TypeScript compiled against ES2022 for Node.js 12 || 14 || 16 || 18 || 20 || 21 with Import for modules
  • badges/edition-types/index.d.ts is TypeScript compiled Types with Import for modules
  • badges/edition-deno/index.ts is TypeScript source code made to be compatible with Deno

History

Discover the release history by heading on over to the HISTORY.md file.

Adding a badge

If you there is a badge that you believe will be common enough for others to benefit from, send in a pull request. Each pull request should:

  1. Add the badge rendering code to the appropriate category section inside source/badges.js
  2. If your badge requires a script to run, it should have badgeScript = true - see other badges for an example
  3. Also remember to export your badge
  4. Add the badges test data to the test file source/test.js
  5. Add the badge configuration information to this readme file README.md
  6. Add the badge name to the keyword field of package.json

These changes can be done in multiple commits or the same, it doesn't matter, as we will squash the commits on merge. We will also the changelog entry, so you don't need to do.

Backers

Code

Discover how to contribute via the CONTRIBUTING.md file.

Authors

Maintainers

Contributors

Finances

GitHub Sponsors donate button ThanksDev donate button Patreon donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button

Sponsors

  • Andrew Nesbitt — Software engineer and researcher
  • Balsa — We're Balsa, and we're building tools for builders.
  • Codecov — Empower developers with tools to improve code quality and testing.
  • Poonacha Medappa
  • Rob Morris
  • Sentry — Real-time crash reporting for your web apps, mobile apps, and games.
  • Syntax — Syntax Podcast

Donors

License

Unless stated otherwise all works are:

and licensed under:

changelog

History

v4.40.0 2023 December 29

v4.39.0 2023 December 27

v4.38.0 2023 December 6

v4.37.0 2023 November 24

v4.36.0 2023 November 21

v4.35.0 2023 November 18

v4.34.0 2023 November 15

v4.33.0 2023 November 14

v4.32.0 2023 November 13

v4.31.0 2023 November 13

v4.30.0 2023 November 12

v4.29.0 2023 November 1

v4.28.0 2023 March 24

v4.27.0 2021 July 30

v4.26.0 2021 July 29

v4.25.0 2021 July 28

v4.24.0 2020 November 23

v4.23.0 2020 October 29

v4.22.0 2020 September 4

v4.21.0 2020 August 17

v4.20.0 2020 August 4

v4.19.0 2020 July 22

v4.18.0 2020 July 22

v4.17.0 2020 July 3

v4.16.0 2020 July 3

v4.15.0 2020 June 26

v4.14.0 2020 June 25

v4.13.0 2020 June 21

v4.12.0 2020 June 21

v4.11.0 2020 June 20

v4.10.0 2020 June 20

v4.9.0 2020 June 10

v4.8.0 2020 June 10

v4.7.0 2020 May 21

v4.6.0 2020 May 21

v4.5.0 2020 May 21

v4.4.0 2020 May 12

v4.3.0 2020 May 11

v4.2.0 2020 May 6

  • Export BadgesList, BadgesConfig BadgesOptions, and BadgesField types

v4.1.0 2020 May 4

v4.0.0 2020 March 26

  • Updated dependencies, base files, and editions using boundation
  • Minimum required node version changed from node: >=8 to node: >=10 to keep up with mandatory ecosystem changes

v3.1.0 2019 December 9

v3.0.0 2019 December 6

  • Converted to TypeScript
  • Fixed thanksapp badge not respecting thanksappUsername
  • Updated dependencies, base files, and editions using boundation

v2.3.0 2019 December 1

v2.2.0 2019 December 1

v2.1.0 2019 December 1

v2.0.0 2019 November 18

  • Updated dependencies, base files, and editions using boundation
  • Minimum required node version changed from node: >=0.8 to node: >=8 to keep up with mandatory ecosystem changes

v1.5.0 2019 November 13

v1.4.0 2019 November 9

v1.3.0 2018 December 19

v1.2.9 2018 November 23

  • Added support for travisTLD configuration option for the travisci badge
    • You can set it to com if you have migrated to travis-ci.com
    • Otherwise you can set it to org (the current default) if you are still on travis-org.com
    • The default will swap over once TravisCI has finished migrating all repositories to travis-ci.com
  • Updated base files using boundation

v1.2.8 2018 October 26

  • Added support for thanksappURL and thanksappUsername for the thanksapp badge

v1.2.7 2018 October 26

  • Added the crypto badge as a replacement for the bitcoin badge

v1.2.6 2018 October 26

  • Fixed the documentation params for the badges
  • Added the new funding badges from v1.2.5 to the readme

v1.2.5 2018 October 26

v1.2.4 2017 January 27

  • meta: update docs URL to not use https

v1.2.3 2017 January 27

  • meta: recompile

v1.2.2 2017 January 26

  • Added Open Collective badge
  • Added Code Climate Rating badge
  • Added BitHound Score badge
  • Fix the error TypeError: Cannot read property 'badgeScript' of undefined which appeared under certain circumstances

v1.2.1 2016 September 19

v1.2.0 2016 May 27

v1.1.2 2016 January 14

v1.1.1 2016 January 14

v1.1.0 2015 December 9

  • Updated internal conventions

v1.0.2 2015 September 18

v1.0.1 2015 September 16

  • Always use https

v1.0.0 2015 September 16