Skip to content

Commit

Permalink
Rename package 🤷
Browse files Browse the repository at this point in the history
  • Loading branch information
bokub committed Sep 1, 2018
1 parent feccd26 commit 803ab99
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# gradient-badges
# gradient-badge

[![npm](https://runkit.io/bokub/gb-v/branches/master)](https://www.npmjs.com/package/gradient-badges)
[![Demo](https://runkit.io/bokub/badge/branches/master/demo/available/11998e-38ef7d)](https://git.io/gradient-badges)
[![XO code style](https://runkit.io/bokub/badge/branches/master/style/XO/ff94c8-cacfda-61eddb)](https://github.com/sindresorhus/xo)
[![License](https://runkit.io/bokub/badge/branches/master/license/MIT/ff426b-ffbc36)](https://github.com/bokub/gradient-badges/blob/master/LICENSE)
[![npm][version]](https://www.npmjs.com/package/gradient-badge)
[![Demo][demo-src]][demo]
[![XO code style][xo]](https://github.com/sindresorhus/xo)
[![License][license]](https://github.com/bokub/gradient-badge/blob/master/LICENSE)

> Badge generator with gradient support
> Badge generator with gradient support 🍭
#### Check out the [demo][demo] to make your own badge

## Install

```
$ npm i gradient-badges
$ npm i gradient-badge
```

## Usage

**gradient-badges** works exactly like [badgen](https://github.com/amio/badgen), with the **`gradient`** parameter in addition.
**gradient-badge** works exactly like [badgen](https://github.com/amio/badgen), with the **`gradient`** parameter in addition.

**Node.js**

```javascript
const badges = require('gradient-badges')
const gradientBadge = require('gradient-badge')

const svgString = badges({
const svgString = gradientBadge({
subject: 'version', // <text>
status: 'v1.2.3', // <text>
style: 'flat', // 'flat' or undefined, optional
Expand All @@ -34,12 +34,9 @@ const svgString = badges({

**Browser**
```html
<script src="https://cdn.jsdelivr.net/npm/gradient-badges@latest/dist/gradient-badges.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/gradient-badge@latest/dist/gradient-badge.min.js"></script>
<script>
var svgString = gradientBadges({
// Same options as above
});
var svgString = gradientBadge({/* same as above */});
</script>
```

Expand Down Expand Up @@ -68,9 +65,14 @@ Here are a few examples of what you can do.

- [badgen](https://github.com/amio/badgen) - Fast handcraft svg badge generator.

[version]: https://runkit.io/bokub/gb-v/branches/master
[demo-src]: https://runkit.io/bokub/badge/branches/master/demo/available/11998e-38ef7d
[xo]: https://runkit.io/bokub/badge/branches/master/style/XO/ff94c8-cacfda-61eddb
[license]: https://runkit.io/bokub/badge/branches/master/license/MIT/ff426b-ffbc36

[usage]: https://runkit.io/bokub/badge/branches/master/version/v1.2.3/pink-F78642?style=flat

[demo]: https://git.io/gradient-badges
[demo]: https://git.io/gradientbadge

[stars]: https://runkit.io/bokub/badge/branches/master/stars/★★★★☆/00a65e-abf269
[standard]: https://runkit.io/bokub/badge/branches/master/code%20style/standard/ff22aa-bf00ff?style=flat
Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "gradient-badges",
"version": "1.1.0",
"name": "gradient-badge",
"description": "Badge generator with gradient support",
"version": "1.2.0",
"author": "Boris K",
"bugs": "https://github.com/bokub/gradient-badge/issues",
"dependencies": {
"badgen": "^2.x"
},
Expand All @@ -15,9 +17,9 @@
},
"files": [
"index.js",
"dist/gradient-badges.min.js"
"dist/gradient-badge.min.js"
],
"homepage": "https://github.com/bokub/gradient-badges",
"homepage": "https://github.com/bokub/gradient-badge",
"keywords": [
"badge",
"badgen",
Expand All @@ -33,6 +35,8 @@
],
"license": "MIT",
"main": "index.js",
"repository": "bokub/gradient-badge",
"reveal": true,
"scripts": {
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"prepublishOnly": "lyo",
Expand Down
10 changes: 5 additions & 5 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import test from 'ava';
import isSvg from 'is-svg';
import colorPresets from 'badgen/lib/color-presets';
import badgen from 'badgen';
import badges from '.';
import b from '.';

for (const style of ['classic', 'flat']) {
const prefix = style === 'classic' ? '[classic] ' : ' [flat] ';
const params = {subject: 'version', status: 'v1.2.3', style, gradient: ['pink', 'F78642']};
const original = badgen(params);
const badge = badges(params);
const badge = b(params);

test(prefix + 'is svg', t => {
t.true(isSvg(badge));
Expand All @@ -31,9 +31,9 @@ for (const style of ['classic', 'flat']) {

test('returns original badgen if no gradient', t => {
const params = {subject: 'version', status: 'v1.2.3'};
t.is(badges(params), badgen(params));
t.is(b(params), badgen(params));
params.color = 'green';
t.is(badges(params), badgen(params));
t.is(b(params), badgen(params));
params.gradient = 'ff0';
t.is(badges(params), badgen(params));
t.is(b(params), badgen(params));
});

0 comments on commit 803ab99

Please sign in to comment.