Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nwtgck/svg-badge-scala

SVG Badge maker in Scala
https://github.com/nwtgck/svg-badge-scala

badge generator scala sheild sheild-badge status-badge svg

Last synced: about 1 month ago
JSON representation

SVG Badge maker in Scala

Awesome Lists containing this project

README

        

# svg-badge
[![CircleCI](https://circleci.com/gh/nwtgck/svg-badge-scala.svg?style=shield)](https://circleci.com/gh/nwtgck/svg-badge-scala)

Create your original badges

## Usual badges

You can create badges widely used by your own!

![build|passing](./output-svg/build-passing.svg)

![build|failing](./output-svg/build-failing.svg)

![converage|91%](./output-svg/coverage-91%25.svg)

![license|MIT](./output-svg/license-mit.svg)

## Original badges

You can also create original badges!

![developer|Pythonista](./output-svg/developer-pythonista.svg)
![developer|Rubyist](./output-svg/developer-rubyist.svg)
![developer|Haskeller](./output-svg/developer-haskeller.svg)
![creator|YouTuber](./output-svg/creator-youtuber.svg)
etc...

## How to use as a library

```scala
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)

```scala
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

```sh
$ cd
$ sbt "runMain io.github.nwtgck.svg_badge.Main"
```

### Example - [build | passing]

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

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