项目作者: bokub

项目描述 :
🍭 Badge generator with color gradient support
高级语言: JavaScript
项目地址: git://github.com/bokub/gradient-badge.git
创建时间: 2018-08-14T11:22:54Z
项目社区:https://github.com/bokub/gradient-badge

开源协议:MIT License

下载


gradient-badge

npm
Build
Coverage
Demo
code style

Badge generator with gradient support 🍭

Check out the demo to make your own badge

Install

  1. $ npm i gradient-badge

Usage

gradient-badge works exactly like badgen, with the gradient parameter in addition.

Node.js

  1. const gradientBadge = require('gradient-badge');
  2. const svgString = gradientBadge({
  3. subject: 'version', // <text>
  4. status: 'v1.2.3', // <text>
  5. style: 'flat', // 'flat' or undefined, optional
  6. // And any other parameter supported by badgen (icon, scale...)
  7. gradient: ['pink', 'F78642'], // array of colors (Hexadecimal or name)
  8. });

Browser

  1. <script src="https://cdn.jsdelivr.net/npm/gradient-badge"></script>
  2. <script>
  3. var svgString = gradientBadge({
  4. /* same as above */
  5. });
  6. </script>

Result: Result

Adding a gradient to a badge

You can apply a color gradient to any badge already generated with badgen:

  1. const { badgen } = require('badgen');
  2. const { applyGradient } = require('gradient-badge');
  3. const originalBadge = badgen({
  4. /* ... */
  5. });
  6. const svgString = applyGradient(originalBadge, ['B65CFF', 'cyan']);

Examples

Here are a few more examples of what you can do.

Check out the demo to make your own

Stars Standard Patreon Instagram Vue.js Rainbow

Dependencies

  • badgen - Fast handcraft svg badge generator.

See also