Version 1.0.0 / 2022-07-05
A Base16 builder is an application that can compile scheme and template files to produce a theme file that can be used to apply custom colours to an application.
A builder accepts scheme data in YAML format from Standard Input in order to create the tag variables needed to parse a template file. The finished result (an application theme) is sent to Standard Output. Any errors are sent to Standard Error.
cat tomorrow-night.yaml | base16-builder --template vim.mustache > tomorrow-night.vim
A builder must provide the following tag variables when parsing a template file:
scheme-name
- obtained from the scheme filescheme-author
- obtained from the scheme filescheme-slug
- obtained from thescheme-name
, lowercased with dashes for spacesbase00-hex
tobase0F-hex
- obtained from the scheme file e.g "7cafc2"base00-hex-bgr
tobase0F-hex-bgr
- built from the hex values reversed e.g "c2af7c"base00-hex-r
tobase0F-hex-r
- built from the hex value in the scheme file e.g "7c"base00-hex-g
tobase0F-hex-g
- built from the hex value in the scheme file e.g "af"base00-hex-b
tobase0F-hex-b
- built from the hex value in the scheme file e.g "c2"base00-rgb-r
tobase0F-rgb-r
- converted from the hex value in the scheme file e.g "124"base00-rgb-g
tobase0F-rgb-g
- converted from the hex value in the scheme file e.g "175"base00-rgb-b
tobase0F-rgb-b
- converted from the hex value in the scheme file e.g "194"base00-dec-r
tobase0F-dec-r
- converted from the rgb value in the scheme file e.g "0.87..."base00-dec-g
tobase0F-dec-g
- converted from the rgb value in the scheme file e.g "0.50..."base00-dec-b
tobase0F-dec-b
- converted from the rgb value in the scheme file e.g "0.21..."base00-hsl-h
tobase0F-hsl-h
- converted from the hex value in the scheme file e.g "0.87..."base00-hsl-s
tobase0F-hsl-s
- converted from the hex value in the scheme file e.g "0.50..."base00-hsl-l
tobase0F-hsl-l
- converted from the hex value in the scheme file e.g "0.21..."
Mustache was chosen as the templating language due to its simplicity and widespread support across languages. Yaml was chosen to describe scheme files for the same reasons.