Separate color scheme data in its own file.
This commit is contained in:
parent
3f906d533b
commit
9bdbe595b9
|
@ -4,7 +4,7 @@ See <https://github.com/h5bp/lazyweb-requests/issues/150>.
|
|||
|
||||
# Contribute
|
||||
|
||||
If you want to add a badge, only modify `badges.json`.
|
||||
If you want to add a badge, you only need to modify `badges.json`.
|
||||
|
||||
The format is the following:
|
||||
|
||||
|
@ -17,7 +17,7 @@ The format is the following:
|
|||
}
|
||||
```
|
||||
|
||||
Color schemes are located at the bottom of the file. Each scheme has a name and
|
||||
Color schemes are located in `colorscheme.json`. Each scheme has a name and
|
||||
a [CSS/SVG color](http://www.w3.org/TR/SVG/types.html#DataTypeColor) for the
|
||||
color used in the first box (for the first piece of text, field `colorA`) and
|
||||
for the one used in the second box (field `colorB`).
|
||||
|
@ -29,8 +29,8 @@ for the one used in the second box (field `colorB`).
|
|||
```
|
||||
|
||||
Both `colorA` and `colorB` have default values. Usually, the first box uses the
|
||||
same dark grey, so you can rely on that default value by not
|
||||
providing a `"colorA"` field (such as above).
|
||||
same dark grey, so you can rely on that default value by not providing a
|
||||
`"colorA"` field (such as above).
|
||||
|
||||
You can also use the `"colorA"` and `"colorB"` fields directly in the badges if
|
||||
you don't want to make a color scheme for it. In that case, remove the
|
||||
|
|
3
badge.js
3
badge.js
|
@ -9,8 +9,7 @@ canvasContext.font = '10px Verdana';
|
|||
|
||||
// Template crafting action below.
|
||||
var dot = require('dot');
|
||||
var badgeData = require('./default-badges.json');
|
||||
var colorscheme = badgeData.colorschemes;
|
||||
var colorscheme = require('./colorscheme.json');
|
||||
var template = fs.readFileSync('./template.svg');
|
||||
var imageTemplate = dot.template(''+template);
|
||||
|
||||
|
|
27
colorscheme.json
Normal file
27
colorscheme.json
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"brightgreen": {
|
||||
"colorA": "#555",
|
||||
"colorB": "#4c1"
|
||||
},
|
||||
"green": {
|
||||
"colorB": "#97CA00"
|
||||
},
|
||||
"yellow": {
|
||||
"colorB": "#dfb317"
|
||||
},
|
||||
"yellowgreen": {
|
||||
"colorB": "#a4a61d"
|
||||
},
|
||||
"orange": {
|
||||
"colorB": "#be7d37"
|
||||
},
|
||||
"red": {
|
||||
"colorB": "#e05d44"
|
||||
},
|
||||
"lightgrey": {
|
||||
"colorB": "#9f9f9f"
|
||||
},
|
||||
"lightgray": {
|
||||
"colorB": "#9f9f9f"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"badges": {
|
||||
"build-passed": {
|
||||
"text": [ "build", "passed" ],
|
||||
"colorscheme": "brightgreen"
|
||||
|
@ -56,32 +55,4 @@
|
|||
"text": [ "coverage", "73%" ],
|
||||
"colorscheme": "red"
|
||||
}
|
||||
},
|
||||
"colorschemes": {
|
||||
"brightgreen": {
|
||||
"colorA": "#555",
|
||||
"colorB": "#4c1"
|
||||
},
|
||||
"green": {
|
||||
"colorB": "#97CA00"
|
||||
},
|
||||
"yellow": {
|
||||
"colorB": "#dfb317"
|
||||
},
|
||||
"yellowgreen": {
|
||||
"colorB": "#a4a61d"
|
||||
},
|
||||
"orange": {
|
||||
"colorB": "#be7d37"
|
||||
},
|
||||
"red": {
|
||||
"colorB": "#e05d44"
|
||||
},
|
||||
"lightgrey": {
|
||||
"colorB": "#9f9f9f"
|
||||
},
|
||||
"lightgray": {
|
||||
"colorB": "#9f9f9f"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
3
make.js
3
make.js
|
@ -3,8 +3,7 @@ var path = require('path');
|
|||
var Promise = require('es6-promise').Promise;
|
||||
|
||||
// Fetch default badge information.
|
||||
var badgeData = require('./default-badges.json');
|
||||
var badges = badgeData.badges;
|
||||
var badges = require('./default-badges.json');
|
||||
var badge = require('./badge.js');
|
||||
|
||||
// Construct the image sheet.
|
||||
|
|
Loading…
Reference in New Issue
Block a user