Skip to content
🎨 Create simple badges in the browser console
JavaScript
Branch: master
Clone or download
Latest commit fb46602 Aug 20, 2019

README.md

🎨 console-badge

Create simple badges in the browser console.

Tiny, easy-to-use package. No dependencies.


Version Downloads npm bundle size License

Build Status Code quality JavaScript Standard Code Style



Features

  • Tiny: Less than 1kB (minified and gzipped). No dependencies. ES5-compliant code.
  • Customizable: Change the font colors, background colors and texts. Tip: You can use the popular shields.io badge style. 😎
  • Flexible: Support for console.log / .warn / .error / .info.

Installation

$ npm install console-badge
# OR
$ yarn add console-badge

Usage

Edit on CodeSandbox

import * as consoleBadge from 'console-badge';

consoleBadge.log({
  mode: 'shields.io',
  leftText: 'console-badge',
  rightText: 'hello world πŸš€',
  rightBgColor: '#ffc107',
  rightTextColor: '#1a1a1a'
});

consoleBadge.log({
  leftText: '😎 Check out our code here:',
  leftTextColor: '#000',
  leftBgColor: '#ddd',
  rightText: 'https://example.com/oss',
  rightBgColor: '#000'
});

πŸ’‘ Please take a look at the API documentation to find out what the different options do and which other console types are supported.

Output:

CDN jsDelivr Hits

For prototyping or learning purposes, you can use the latest version with:

<script src="https://cdn.jsdelivr.net/npm/console-badge"></script>

For production, we recommend linking to a specific version number and build to avoid unexpected breakage from newer versions:

<script src="https://cdn.jsdelivr.net/npm/console-badge@1/dist/console-badge.umd.min.js"></script>
// Global variable
consoleBadge.log();
// Property in the window object
window.consoleBadge.log();

⚠ NPM is the recommended installation method. It pairs nicely with module bundlers such as webpack.

Documentation

Show your support

Please ⭐️ this repository if this project helped you!

Issues

Please make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.

Changelog

Detailed changes for each release are documented in the release notes.

Contribution

Please make sure to read the Contributing Guide before making a pull request.

Thank you to all the people who have already contributed to this project!

License

MIT

Copyright (c) 2019-present, Dennis Herzberg

You can’t perform that action at this time.