rainbou
rainbou copied to clipboard
Theme generator
Rainbou
Rainbou [reyn-boh] is a command-line tool that generates themes for a diversity of programs (as long as it has templates written for them).
Given a color scheme and a template file,
rainbou will generate a theme and print it to stdout (your
terminal's screen).
Installation
go get -u github.com/tudurom/rainbou
You can use the same command for updating the program.
Usage
─── ./rainbou
Usage:
$ rainbou <scheme_file> <template_file> - generate theme and print it on the screen
$ rainbou ls <schemes|templates|s|t> - list bundled color schemes/templates
Where scheme_file is the name or the path of the color scheme file and
template_file is the name or the path of the color scheme file.
Color scheme format
Color scheme files are yaml files that have the following structure:
metadata:
name: foo
author: bar
colors:
bg: "000000"
fg: "ffffff"
cr: "ffffff"
00: "aaaaaa"
08: "bbbbbb"
01: "cccccc"
09: "dddddd"
...
07: "eeeeee"
15: "ffffff"
Where bg is the background color, fg is the foreground color, cr is the
color of the cursor and 00 to 15 are terminal ANSI color code numbers.
Colors are written as an HTML color code without the leading #.
Template file format
Template files are normal Go template files. Example:
! {{.Metadata.Name}} by {{.Metadata.Author}}
! special
*.foreground: #{{index .ColorMap "fg" "hex"}}
*.background: #{{index .ColorMap "bg" "hex"}}
*.cursorColor: #{{index .ColorMap "cr" "hex"}}
! black
*.color0: #{{index .ColorMap "00" "hex"}}
*.color8: #{{index .ColorMap "08" "hex"}}
! red
*.color1: #{{index .ColorMap "01" "hex"}}
*.color9: #{{index .ColorMap "09" "hex"}}
! green
*.color2: #{{index .ColorMap "02" "hex"}}
*.color10: #{{index .ColorMap "10" "hex"}}
! yellow
*.color3: #{{index .ColorMap "03" "hex"}}
*.color11: #{{index .ColorMap "11" "hex"}}
! blue
*.color4: #{{index .ColorMap "04" "hex"}}
*.color12: #{{index .ColorMap "12" "hex"}}
! magenta (or orange)
*.color5: #{{index .ColorMap "05" "hex"}}
*.color13: #{{index .ColorMap "13" "hex"}}
! cyan
*.color6: #{{index .ColorMap "06" "hex"}}
*.color14: #{{index .ColorMap "14" "hex"}}
! white
*.color7: #{{index .ColorMap "07" "hex"}}
*.color15: #{{index .ColorMap "15" "hex"}}
! vim: set ft=xdefaults :
{{.Metadata.Name}} is the name of the color scheme and {{.Metadata.Author}}
is the name of the Author.
Colors can be written as:
{{index .ColorMap "<code>" "<format>"}}
Where <code> is a number from 00 to 15 and <format> is any of the following:
-
hex- HTML color code without the leading# -
hexbgr- likehexbut with the color components reversed (123456->563412) -
dhex- "double"hex; likehexbut with color components doubled (123456->121234345656) -
rgb- array consisting of three color components. The values are in the [0-255] range. To access theRcomponent:{{index .ColorMap "<code>" "rgb" 0}} -
srgb- same asrgbbut with values ranging from0to1.