Skip to content

nwtgck/svg-badge-scala

Repository files navigation

svg-badge

CircleCI

Create your original badges

Usual badges

You can create badges widely used by your own!

build|passing

build|failing

converage|91%

license|MIT

Original badges

You can also create original badges!

developer|Pythonista developer|Rubyist developer|Haskeller creator|YouTuber etc...

How to use as a library

import scala.xml.Elem
import io.github.nwtgck.svg_badge.SvgBadgeMaker

val svg: Elem = SvgBadgeMaker.generate(width = 90, subjectWidth = 40, subjectText = "build", statusText = "passing", badgeColor = "#6c3")

// Then you can use `svg` variable, for example, `println(svg)` or something.

or (use smartGenerate which allows you not to specify widths)

import scala.xml.Elem
import io.github.nwtgck.svg_badge.SvgBadgeMaker

val svg: Elem = SvgBadgeMaker.smartGenerate(subjectText = "build", statusText = "passing", badgeColor = "#6c3")

// Then you can use `svg` variable, for example, `println(svg)` or something.

How to use this as an executable program

$ cd <this repo>
$ sbt "runMain io.github.nwtgck.svg_badge.Main" <subject:String> <status:String> <color:String> 

Example - [build | passing]

$ sbt "runMain io.github.nwtgck.svg_badge.Main build passing #6c3" 

Then you can get './build-passing.svg'