Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

badge-up2

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

badge-up2

A module that produces SVG badges

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
134
decreased by-3.6%
Maintainers
1
Weekly downloads
 
Created
Source

badge-up2

Build codecov npm downloads

This is a simple library that generates SVG badges, based on badge-up.

Install

npm install badge-up2

Basic Usage

const { basic, basicColors } = require('badge-up2');
const svg = basic('batman', 'component', basicColors.green);

example

The color argument can be a CSS color, or one of the specially named colors found in basicColors.

Advanced Usage

With this API you can create arbitrary badges with an arbitrary number of sections.

Each section is either a string or a hash. The hash should have the following properties:

  • text: The text to display in the section
  • color (optional): The background color of the section. This can be either a six-character hex code or a css color name.
  • strokeColor (optional): The color of the section border

If color is not provided, then a default is used. The default color for the first section is #696969 and #d3d3d3 for subsequent sections. Passing a string rather than a hash is equivalent to passing a hash with only the text property.

const { badge } = require('badge-up2');
const sections = [
    'foo/far;fun',
    { text: 'bar\nbaz', color: 'orange'},
    { text: 'mork "mindy"', color: 'olive', strokeColor: 'white'},
    { text: '<∀>', color: 'moccasin'},
];
const svg = badge(sections);

example

Keywords

FAQs

Package last updated on 15 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc