Tai is a Deno badge generation module. It is written with Maintained's badging system in mind.
The following are examples of Tai badges:
You may need to run scripts that use Tai with the allow-read
permission, if you use icons in your badges. Tai reads downloaded icons from the filesystem in ./icon/simple-icons/icons
, relative from the Deno execution context.
import { generate } from "https://deno.land/x/tai/mod.ts";
const badge = {
fields: [
{
content: "Build Status",
color: 0, // 0-6 or BadgeColor.Simple (etc), refer to BadgeColor enum
width: 93 // specifies width of badge text (11px Verdana)
},
{
content: "Passing",
color: 4,
width: 67
},
// ...
// Minimum one field, unlimited maximum for true mayhem
],
style: 0 // 0-2 or BadgeStyle.Plastic (etc), refer to BadgeStyle enum
}
// Returns SVG string of badge
const svg = await generate(badge);
enum BadgeColor {
Simple,
Slate,
Seabed,
Subterranean,
Savannah,
Sahara,
Sunset
}
enum BadgeStyle {
Plastic,
Flat,
ForTheBadge
}
Because Tai is built with Maintained in mind first and foremost, it offloads the width calculation of badge fields to the Maintained dashboard (or whatever project consumes it). This makes sense to reduce development overhead because browsers/web apps can calculate the width easily, while an additional package would be needed in Tai.