badges / gh-badges

Go to badges/shields. Especially if you don't know why. (This repo is old.)
http://img.shields.io/
Creative Commons Zero v1.0 Universal
87 stars 29 forks source link

Add build script that generates SVG badges based on template #2

Closed mathiasbynens closed 10 years ago

mathiasbynens commented 10 years ago

This repository will mainly host the template on which the SVG badges are used.

But we’ll want to create several badges with different settings:

It would be cool if, whenever we make changes to the main template, the various badges can be updated just by running a build script.

I’m thinking: a JSON config file that contains settings for each badge (incl. width for each part of the badge as well as the name of the gradient/color combination that should be used). So, for each badge, there would be an entry like this:

{
  "text": [ "build", "passed" ],
  "widths": [ 77, 45 ],
  "colorscheme": "green"
}

Any other ideas?

espadrine commented 10 years ago

I modified your format a bit. The minimum required is the following:

"build-passed": {
  /* Textual information shown, in order. */
  "text": [ "build", "passed" ],
  /* Width of the first box, width of the second box. */
  "widths": [ 33, 44 ],
  /* Gradient of the background color of the second box. */
  "colorB": [ "#8f6", "#4c1", "#3b0", "#370" ]
}
mathiasbynens commented 10 years ago

I’d still prefer referring to a color scheme name rather than hardcoding the colors in the file, as color schemes are likely to be re-used with different text. Or am I missing something?

espadrine commented 10 years ago

Where would we define the color schemes? In a different file?

Are there two distinct badges with the same color scheme in the wild?

mathiasbynens commented 10 years ago

Where would we define the color schemes? In a different file?

Yeah, or maybe in the same file in a separate property at the top? Something like:

{
  "color-schemes": { … },
  "badges": { … }
}

Are there two distinct badges with the same color scheme in the wild?

Sure, e.g. https://github.com/mathiasbynens/he#readme has these (from two different services!):

Build status Dependency status

https://github.com/svg/svgo#svgo---- has:

NPM version Dependency Status Build Status Coverage Status

espadrine commented 10 years ago

Ironically, it uses a different gradient!