Package Exports
- gradient-badge
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gradient-badge) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gradient-badge
Badge generator with gradient support 🍭
Check out the demo to make your own badge
Install
$ npm i gradient-badgeUsage
gradient-badge works exactly like badgen, with the gradient parameter in addition.
Node.js
const gradientBadge = require('gradient-badge');
const svgString = gradientBadge({
subject: 'version', // <text>
status: 'v1.2.3', // <text>
style: 'flat', // 'flat' or undefined, optional
// And any other parameter supported by badgen (icon, scale...)
gradient: ['pink', 'F78642'], // array of colors (Hexadecimal or name)
});Browser
<script src="https://cdn.jsdelivr.net/npm/gradient-badge"></script>
<script>
var svgString = gradientBadge({
/* same as above */
});
</script>Result:
Adding a gradient to a badge
You can apply a color gradient to any badge already generated with badgen:
const { badgen } = require('badgen');
const { applyGradient } = require('gradient-badge');
const originalBadge = badgen({
/* ... */
});
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
Dependencies
- badgen - Fast handcraft svg badge generator.
See also
- badge-action - Create a badge using GitHub Actions.