aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Byron <=>2015-07-17 17:37:57 +1000
committerDaniel Byron <=>2015-07-17 17:37:57 +1000
commita9f15e2c2a670f9796a0e898fa6cf39fb79e579f (patch)
tree46f5255463c45e93e2e2eb35faca978caebe1067
downloadschemer2-a9f15e2c2a670f9796a0e898fa6cf39fb79e579f.tar.xz
schemer2-a9f15e2c2a670f9796a0e898fa6cf39fb79e579f.zip
Moved from Bitbucket to Github
-rw-r--r--README.md86
-rw-r--r--TODO.md13
-rw-r--r--format.go89
-rw-r--r--image.go313
-rw-r--r--input.go258
-rw-r--r--main.go137
-rw-r--r--output.go248
-rwxr-xr-xtests/Terminals/TestAllTerminals.sh13
-rw-r--r--tests/Terminals/lilyterm/test549
-rw-r--r--tests/Terminals/terminator/test14
-rw-r--r--tests/Terminals/termite/test71
-rw-r--r--tests/Terminals/urxvt/test66
-rw-r--r--tests/Terminals/xfce/test28
-rw-r--r--tests/Terminals/xterm/test17
-rw-r--r--tests/image/Image2Image.sh11
-rw-r--r--tests/image/testinput.pngbin0 -> 10824 bytes
16 files changed, 1913 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8f2134e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,86 @@
+# UNDER CONSTRUCTION
+
+Various aspects of this program are still being developed. Command line usage is quite probably going to change somewhat from as it is now.
+
+Terminal Colorscheme Generator
+==============================
+
+## Screenshot
+![Screenshot](http://i.imgur.com/TSLluID.png)
+
+## Installation
+
+### AUR
+
+There is now an AUR package for schemer at https://aur.archlinux.org/packages/schemer/
+
+### Short version
+
+> go get github.com/thefryscorer/schemer
+
+### Long Version
+
+#### Installing and configuring Go
+To build this program, you will need to have Go installed and properly configured. After installing the Go package, you will need to configure a GOPATH. This is a directory in which Go will keep its programs and source files. I recommend making the GOPATH directory in your home folder. If your GOPATH is in your root directory a kitten will die.
+
+> mkdir ~/Go
+
+You will also need to set the GOPATH variable so that Go knows where to put things. You can do this by running:
+
+> export GOPATH=$HOME/Go
+
+NOTE: You don't need to (and shouldn't) set the $GOROOT variable. This is handled for you and you shouldn't mess with it.
+
+#### Installing SDL1.2
+This program also makes use of SDL1.2 for the color preview window (which you can use by adding the "-d" flag in schemer). As such, SDL1.2 will need to be installed on your system for you to build and run schemer.
+
+**To install SDL1.2 in ArchLinux:**
+
+> sudo pacman -S sdl sdl_image sdl_ttf sdl_mixer
+
+**To install SDL1.2 in Mac OS:**
+
+> brew install sdl sdl_image sdl_ttf sdl_mixer
+
+If you haven't installed HomeBrew, you can find it at http://brew.sh
+
+
+**To install SDL1.2 on another system:**
+
+Learn how to use Google and your package manager. Both are very useful.
+
+#### Installing schemer
+You should now be able to install schemer using the command:
+
+> go get github.com/thefryscorer/schemer
+
+And it will be built in your GOPATH directory, in a subdirectory named 'bin'. To run it, you can either add $HOME/Go/bin to your system path and run it as you would any other command. Or cd into the bin directory and run it with:
+
+> ./schemer
+
+## Usage
+
+> schemer -term="xfce" Image.png
+
+Then copy the generated config lines into your terminal config file.
+
+## Features
+
+- Outputs configuration in several different formats for different terminals.
+- Configurable color difference threshold
+- Configurable minimum and maximum brightness value
+- Can preview colorscheme in SDL window
+
+## Supported output formats
+
+- Colours in just plain text (default)
+- Konsole
+- xterm/rxvt/aterm
+- urxvt
+- iTerm2
+- XFCE Terminal
+- Roxterm
+- LilyTerm
+- Terminator
+- Chrome Shell
+- OS X Terminal
diff --git a/TODO.md b/TODO.md
new file mode 100644
index 0000000..4f0fab3
--- /dev/null
+++ b/TODO.md
@@ -0,0 +1,13 @@
+# To Do
+
+- Redesign command line interface to accomodate new features
+- Support for following terminal inputs
+ + Xterm
+ + Urxvt
+ + Mac Terminal
+ + iTerm2
+ + RoxTerm
+ + Konsole
+ + Plain text
+- Expose more advanced options for image generation
+- Write more tests
diff --git a/format.go b/format.go
new file mode 100644
index 0000000..82fa53f
--- /dev/null
+++ b/format.go
@@ -0,0 +1,89 @@
+package main
+
+import (
+ "image/color"
+)
+
+type inputFunction (func(filename string) ([]color.Color, error))
+type outputFunction (func([]color.Color) string)
+
+type Format struct {
+ friendlyName string
+ flagName string
+ output outputFunction
+ input inputFunction
+}
+
+var formats = []Format{
+ {
+ friendlyName: "Colors in Plain Text",
+ flagName: "colors",
+ output: printColors,
+ },
+ {
+ friendlyName: "Image",
+ flagName: "img",
+ input: colorsFromImage,
+ },
+ {
+ friendlyName: "XFCE4Terminal",
+ flagName: "xfce",
+ input: inputXfce,
+ output: printXfce,
+ },
+ {
+ friendlyName: "LilyTerm",
+ flagName: "lilyterm",
+ output: printLilyTerm,
+ input: inputLilyTerm,
+ },
+ {
+ friendlyName: "Termite",
+ flagName: "termite",
+ input: inputTermite,
+ output: printTermite,
+ },
+ {
+ friendlyName: "Terminator",
+ flagName: "terminator",
+ input: inputTerminator,
+ output: printTerminator,
+ },
+ {
+ friendlyName: "ROXTerm",
+ flagName: "roxterm",
+ output: printRoxTerm,
+ },
+ {
+ friendlyName: "rxvt/xterm/aterm",
+ flagName: "xterm",
+ input: inputXterm,
+ output: printXterm,
+ },
+ {
+ friendlyName: "Konsole",
+ flagName: "konsole",
+ output: printKonsole,
+ },
+ {
+ friendlyName: "iTerm2",
+ flagName: "iterm2",
+ output: printITerm2,
+ },
+ {
+ friendlyName: "urxvt",
+ flagName: "urxvt",
+ input: inputXterm,
+ output: printURxvt,
+ },
+ {
+ friendlyName: "Chrome Shell",
+ flagName: "chrome",
+ output: printChrome,
+ },
+ {
+ friendlyName: "OS X Terminal",
+ flagName: "osxterminal",
+ output: printOSXTerminal,
+ },
+}
diff --git a/image.go b/image.go
new file mode 100644
index 0000000..93789e9
--- /dev/null
+++ b/image.go
@@ -0,0 +1,313 @@
+package main
+
+import (
+ "errors"
+ "image"
+ "image/color"
+ _ "image/jpeg"
+ _ "image/png"
+ "log"
+ "math"
+ "math/rand"
+ "os"
+ "time"
+)
+
+func loadImage(filepath string) image.Image {
+ infile, err := os.Open(filepath)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer infile.Close()
+
+ src, _, err := image.Decode(infile)
+ if err != nil {
+ log.Fatal(err)
+ }
+ return src
+}
+
+func abs(n int) int {
+ if n >= 0 {
+ return n
+ }
+ return -n
+}
+
+func colorDifference(col1 color.Color, col2 color.Color, threshold int) bool {
+ c1 := col1.(color.NRGBA)
+ c2 := col2.(color.NRGBA)
+
+ rDiff := abs(int(c1.R) - int(c2.R))
+ gDiff := abs(int(c1.G) - int(c2.G))
+ bDiff := abs(int(c1.B) - int(c2.B))
+
+ total := rDiff + gDiff + bDiff
+ return total >= threshold
+}
+
+func getDistinctColors(colors []color.Color, threshold int, minBrightness, maxBrightness int) []color.Color {
+ distinctColors := make([]color.Color, 0)
+ for _, c := range colors {
+ same := false
+ if !colorDifference(c, color.NRGBAModel.Convert(color.Black), minBrightness*3) {
+ continue
+ }
+ if !colorDifference(c, color.NRGBAModel.Convert(color.White), (255-maxBrightness)*3) {
+ continue
+ }
+ for _, k := range distinctColors {
+ if !colorDifference(c, k, threshold) {
+ same = true
+ break
+ }
+ }
+ if !same {
+ distinctColors = append(distinctColors, c)
+ }
+ }
+ return distinctColors
+}
+
+func colorsFromImage(filename string) ([]color.Color, error) {
+ // Load the image and create array of colors
+ fuzzyness := 5
+ img := loadImage(filename)
+ w, h := img.Bounds().Max.X, img.Bounds().Max.Y
+ colors := make([]color.Color, 0, w*h)
+ for x := 0; x < w; x += fuzzyness {
+ for y := 0; y < h; y += fuzzyness {
+ col := color.NRGBAModel.Convert(img.At(x, y))
+ colors = append(colors, col)
+ }
+ }
+ // Get the distinct colors from the array by comparing differences with a threshold
+ distinctColors := getDistinctColors(colors, *threshold, *minBrightness, *maxBrightness)
+
+ // Ensure there are 16 colors
+ count := 0
+ for len(distinctColors) < 16 {
+ count++
+ distinctColors = append(distinctColors, getDistinctColors(colors, *threshold-count, *minBrightness, *maxBrightness)...)
+ if count == *threshold {
+ return nil, errors.New("Could not get colors from image with settings specified. Aborting.\n")
+ }
+ }
+
+ if len(distinctColors) > 16 {
+ distinctColors = distinctColors[:16]
+ }
+
+ return distinctColors, nil
+}
+
+func imageFromColors(colors []color.Color, w int, h int) image.Image {
+ rand.Seed(time.Now().UnixNano())
+ switch rand.Intn(4) {
+ case 0:
+ // Circles
+ switch rand.Intn(2) {
+ case 0:
+ return Circles(colors, w, h, false)
+ case 1:
+ return Circles(colors, w, h, true)
+ }
+ case 1:
+ // Rays
+ switch rand.Intn(2) {
+ case 0:
+ return Rays(colors, w, h, true, rand.Intn(w/24))
+ case 1:
+ return Rays(colors, w, h, false, rand.Intn(w/24))
+ }
+ case 2:
+ // Horizontal Lines
+ switch rand.Intn(2) {
+ case 0:
+ return HorizontalLines(colors, w, h, false)
+ case 1:
+ return HorizontalLines(colors, w, h, true)
+ }
+ case 3:
+ // Vertical Lines
+ switch rand.Intn(4) {
+ case 0:
+ return VerticalLines(colors, w, h, false, false)
+ case 1:
+ return VerticalLines(colors, w, h, true, false)
+ case 2:
+ return VerticalLines(colors, w, h, false, true)
+ case 3:
+ return VerticalLines(colors, w, h, true, true)
+ }
+ }
+ return nil
+}
+
+type Circle struct {
+ col color.Color
+ x, y int
+ size int
+}
+
+func Circles(colors []color.Color, w int, h int, filled bool) image.Image {
+ img := image.NewNRGBA(image.Rect(0, 0, w, h))
+
+ circles := make([]Circle, 0)
+
+ for _, c := range colors {
+ circle := Circle{c, rand.Intn(w), rand.Intn(h), rand.Intn(w / 2)}
+ circles = append(circles, circle)
+ }
+
+ bg := colors[0]
+ border := rand.Intn(w / 24)
+
+ for x := 0; x < w; x++ {
+ for y := 0; y < h; y++ {
+ img.Set(x, y, bg)
+ for _, c := range circles {
+ a := float64((x - c.x) * (x - c.x))
+ b := float64((y - c.y) * (y - c.y))
+
+ if filled {
+ if int(math.Sqrt(a+b)) < c.size {
+ img.Set(x, y, c.col)
+ }
+ } else {
+ if int(math.Sqrt(a+b)) < c.size && int(math.Sqrt(a+b)) > (c.size-border) {
+ img.Set(x, y, c.col)
+ }
+ }
+ }
+ }
+ }
+ return img
+}
+
+type Stripe struct {
+ col color.Color
+ x, y int // Middle point
+ angle int // 0-180
+}
+
+func Rays(colors []color.Color, w int, h int, centered bool, margin int) image.Image {
+ img := image.NewNRGBA(image.Rect(0, 0, w, h))
+
+ stripes := make([]Stripe, 0)
+
+ for _, c := range colors {
+ var stripe Stripe
+ if centered {
+ stripe = Stripe{c, w / 2, h / 2, rand.Intn(180)}
+ } else {
+ stripe = Stripe{c, rand.Intn(w), rand.Intn(h), rand.Intn(180)}
+ }
+ stripes = append(stripes, stripe)
+ }
+
+ bg := colors[0]
+
+ for x := 0; x < w; x++ {
+ for y := 0; y < h; y++ {
+ img.Set(x, y, bg)
+ for _, s := range stripes {
+ deltaX := float64(x - s.x)
+ deltaY := float64(y - s.y)
+ angle := math.Atan(deltaY/deltaX) * 180 / math.Pi
+ if int(math.Abs(float64(int(angle)-s.angle))) < margin {
+ img.Set(x, y, s.col)
+ }
+ }
+ }
+ }
+ return img
+}
+
+type VerticalLine struct {
+ col color.Color
+ x int
+ w int
+}
+
+type HorizontalLine struct {
+ col color.Color
+ y int
+ h int
+}
+
+func VerticalLines(colors []color.Color, w int, h int, evenlySpaced bool, evenWidth bool) image.Image {
+ img := image.NewNRGBA(image.Rect(0, 0, w, h))
+
+ lines := make([]VerticalLine, 0)
+
+ var width int
+ width = rand.Intn(w / 16)
+
+ x_index := rand.Intn(w / 2)
+
+ var spacing int
+ spacing = rand.Intn(w / 32)
+
+ for _, c := range colors {
+ if !evenWidth {
+ width = rand.Intn(w / 16)
+ }
+ if !evenlySpaced {
+ spacing = rand.Intn(w / 32)
+ }
+ x_index += spacing
+ lines = append(lines, VerticalLine{c, x_index, width})
+ x_index += width
+ }
+
+ bg := colors[0]
+
+ for x := 0; x < w; x++ {
+ for y := 0; y < h; y++ {
+ img.Set(x, y, bg)
+ for _, l := range lines {
+ if x >= l.x && x < l.x+l.w {
+ img.Set(x, y, l.col)
+ }
+ }
+ }
+ }
+
+ return img
+
+}
+
+func HorizontalLines(colors []color.Color, w int, h int, evenHeight bool) image.Image {
+ img := image.NewNRGBA(image.Rect(0, 0, w, h))
+
+ lines := make([]HorizontalLine, 0)
+
+ var height int
+ if evenHeight {
+ height = rand.Intn(h / 16)
+ }
+
+ for _, c := range colors {
+ if !evenHeight {
+ height = rand.Intn(h / 16)
+ }
+ lines = append(lines, HorizontalLine{c, rand.Intn(h), height})
+ }
+
+ bg := colors[0]
+
+ for x := 0; x < w; x++ {
+ for y := 0; y < h; y++ {
+ img.Set(x, y, bg)
+ for _, l := range lines {
+ if y >= l.y && y < l.y+l.h {
+ img.Set(x, y, l.col)
+ }
+ }
+ }
+ }
+
+ return img
+
+}
diff --git a/input.go b/input.go
new file mode 100644
index 0000000..37aeb75
--- /dev/null
+++ b/input.go
@@ -0,0 +1,258 @@
+package main
+
+import (
+ "encoding/hex"
+ "errors"
+ "image/color"
+ "io/ioutil"
+ "regexp"
+ "strconv"
+ "strings"
+)
+
+func readFile(filename string) (string, error) {
+ bytes, err := ioutil.ReadFile(filename)
+ if err != nil {
+ return "", err
+ }
+
+ config := string(bytes[:])
+ return config, nil
+}
+
+func parseColor(c string) (color.Color, error) {
+ // Takes in a string of the format #FFFFFF or #FFFFFFFFFFFF and returns a color
+ // Remove leading #
+ c = strings.TrimPrefix(c, "#")
+ // Convert hexadecimal string to array of bytes.
+ bytes, err := hex.DecodeString(c)
+ if err != nil {
+ return nil, err
+ }
+
+ // Covert to array of uint8s
+ uints := []uint8(bytes[:])
+
+ // Take 0,1,2 indexes for a 6 character string, and 0,2,4 indexes for 12 characters
+ if len(uints) == 6 {
+ return color.NRGBA{uints[0], uints[2], uints[4], 255}, nil
+ } else if len(uints) == 3 {
+ return color.NRGBA{uints[0], uints[1], uints[2], 255}, nil
+ }
+
+ return nil, errors.New("Could not parse color: " + c)
+}
+
+func inputXfce(filename string) ([]color.Color, error) {
+ // Read in file
+ config, err := readFile(filename)
+ if err != nil {
+ return nil, err
+ }
+
+ // Split into lines
+ lines := strings.Split(config, "\n")
+
+ // Remove all spaces
+ for i, l := range lines {
+ lines[i] = strings.Replace(l, " ", "", -1)
+ }
+
+ // Find line containing color palette
+ colorpalette := ""
+ for _, l := range lines {
+ if strings.HasPrefix(l, "ColorPalette") {
+ colorpalette = l
+ }
+ }
+ if colorpalette == "" {
+ return nil, errors.New("ColorPalette not found in XFCE4 Terminal input")
+ }
+
+ // Get colors from palette
+ colorpalette = strings.TrimPrefix(colorpalette, "ColorPalette=")
+ // Trim trailing semicolon and spaces
+ colorpalette = strings.TrimRight(colorpalette, "; ")
+ // Split by semicolons
+ colorStrings := strings.Split(colorpalette, ";")
+
+ colors := make([]color.Color, 0)
+
+ for _, c := range colorStrings {
+ col, err := parseColor(c)
+ if err != nil {
+ return nil, err
+ }
+ colors = append(colors, col)
+ }
+
+ return colors, nil
+}
+
+func inputLilyTerm(filename string) ([]color.Color, error) {
+ colors := make([]color.Color, 0)
+
+ // Read in file
+ config, err := readFile(filename)
+ if err != nil {
+ return nil, err
+ }
+
+ // Split into lines
+ lines := strings.Split(config, "\n")
+
+ // Remove all spaces
+ for i, l := range lines {
+ lines[i] = strings.Replace(l, " ", "", -1)
+ }
+
+ // For all 16 colors (Color1, Color2...), search for each.
+ // TODO: Support for 16 bit, and "black"
+ for i := 0; i < 16; i++ {
+ for _, l := range lines {
+ prefix := "Color"
+ prefix += strconv.Itoa(i)
+ prefix += "="
+ if strings.HasPrefix(l, prefix) {
+ // Trim Prefix
+ hexstring := strings.TrimPrefix(l, prefix)
+
+ col, err := parseColor(hexstring)
+ if err != nil {
+ return nil, err
+ }
+
+ colors = append(colors, col)
+
+ }
+ }
+ }
+
+ return colors, nil
+}
+
+func inputTermite(filename string) ([]color.Color, error) {
+ colors := make([]color.Color, 0)
+
+ // Read in file
+ config, err := readFile(filename)
+ if err != nil {
+ return nil, err
+ }
+
+ // Split into lines
+ lines := strings.Split(config, "\n")
+
+ // Remove all spaces
+ for i, l := range lines {
+ lines[i] = strings.Replace(l, " ", "", -1)
+ }
+
+ // For all 16 colors (Color1, Color2...), search for each.
+ for i := 0; i < 16; i++ {
+ for _, l := range lines {
+ prefix := "color"
+ prefix += strconv.Itoa(i)
+ prefix += "="
+ if strings.HasPrefix(l, prefix) {
+ // Trim Prefix
+ hexstring := strings.TrimPrefix(l, prefix)
+
+ col, err := parseColor(hexstring)
+ if err != nil {
+ return nil, err
+ }
+
+ colors = append(colors, col)
+ }
+ }
+ }
+
+ return colors, nil
+}
+
+func inputTerminator(filename string) ([]color.Color, error) {
+ // Read in file
+ config, err := readFile(filename)
+ if err != nil {
+ return nil, err
+ }
+
+ // Split into lines
+ lines := strings.Split(config, "\n")
+
+ // Remove all spaces
+ for i, l := range lines {
+ lines[i] = strings.Replace(l, " ", "", -1)
+ }
+
+ // Find line containing color palette
+ colorpalette := ""
+ for _, l := range lines {
+ if strings.HasPrefix(l, "palette") {
+ colorpalette = l
+ }
+ }
+ if colorpalette == "" {
+ return nil, errors.New("ColorPalette not found in XFCE4 Terminal input")
+ }
+
+ // Get colors from palette
+ colorpalette = strings.TrimPrefix(colorpalette, "palette=\"")
+ colorpalette = strings.TrimSuffix(colorpalette, "\"")
+
+ colorStrings := strings.Split(colorpalette, ":")
+
+ colors := make([]color.Color, 0)
+
+ for _, c := range colorStrings {
+ col, err := parseColor(c)
+ if err != nil {
+ return nil, err
+ }
+ colors = append(colors, col)
+ }
+ return colors, nil
+
+}
+
+func inputXterm(filename string) ([]color.Color, error) {
+ // Read in file
+ config, err := readFile(filename)
+ if err != nil {
+ return nil, err
+ }
+
+ // Split into lines
+ lines := strings.Split(config, "\n")
+
+ // Remove all spaces
+ for i, l := range lines {
+ lines[i] = strings.Replace(l, " ", "", -1)
+ }
+
+ colorlines := make([]string, 0)
+ // Search for lines containing color information
+ re := regexp.MustCompile("[\\*]?[URXvurxterm]*[\\*.]+color[0-9]*")
+ for _, l := range lines {
+ if len(re.FindAllString(l, 1)) != 0 {
+ colorlines = append(colorlines, l)
+ }
+ }
+
+ // Extract and parse colors
+ // TODO: Sort by number first?
+ colors := make([]color.Color, 0)
+ for _, l := range colorlines {
+ // Assuming the color to be the rightmost half of the last colon
+ splits := strings.Split(l, ":")
+ colorstring := splits[len(splits)-1]
+ col, err := parseColor(colorstring)
+ if err != nil {
+ return nil, err
+ }
+ colors = append(colors, col)
+ }
+
+ return colors, nil
+}
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..5f2d419
--- /dev/null
+++ b/main.go
@@ -0,0 +1,137 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "image/color"
+ "image/png"
+ "log"
+ "os"
+ "strings"
+)
+
+var (
+ threshold *int
+ output *string
+ input *string
+ minBrightness *int
+ maxBrightness *int
+ imageout *string
+ imageWidth *int
+ imageHeight *int
+)
+
+func usage() {
+ fmt.Println("Usage: schemer2 [FLAGS] -in=[FORMAT]:[FILENAME] (-out=[FORMAT] | -outputImage=[FILENAME])")
+ flag.PrintDefaults()
+ os.Exit(2)
+}
+
+func main() {
+ inSupport := "Format and filename of input file (eg \"xfce:~/.config/xfce4/terminal/terminalrc\"). Currently supported: \n"
+ outSupport := "Format to output colors as. Currently supported: \n"
+ for _, f := range formats {
+ if f.output != nil {
+ outSupport += strings.Join([]string{" ", f.friendlyName, ":", f.flagName, "\n"}, " ")
+ }
+
+ if f.input != nil {
+ inSupport += strings.Join([]string{" ", f.friendlyName, ":", f.flagName, "\n"}, " ")
+ }
+ }
+
+ threshold = flag.Int("t", 50, "Threshold for minimum color difference (image input only)")
+ output = flag.String("out", "", outSupport)
+ input = flag.String("in", "", inSupport)
+ minBrightness = flag.Int("minBright", 0, "Minimum brightness for colors (image input only)")
+ maxBrightness = flag.Int("maxBright", 200, "Maximum brightness for colors (image input only)")
+ imageout = flag.String("outputImage", "", "Create image from colors, and save to this file")
+ imageHeight = flag.Int("h", 1080, "Height of output image")
+ imageWidth = flag.Int("w", 1920, "Width of output image")
+
+ flag.Usage = usage
+ flag.Parse()
+ if *input == "" {
+ usage()
+ os.Exit(2)
+ }
+ if *minBrightness > 255 || *maxBrightness > 255 {
+ fmt.Print("Minimum and maximum brightness must be an integer between 0 and 255.\n")
+ os.Exit(2)
+ }
+ if *threshold > 255 {
+ fmt.Print("Threshold should be an integer between 0 and 255.\n")
+ os.Exit(2)
+ }
+
+ if *imageWidth < 100 || *imageHeight < 100 {
+ log.Fatal("Minimum resolution of image output is 100x100")
+ }
+
+ // Determine format and filename
+ // And get colors from file using specified format
+ format := strings.SplitN(*input, ":", 2)[0]
+ filename := strings.SplitN(*input, ":", 2)[1]
+
+ formatInMatch := false
+ var colors []color.Color
+ var err error
+ for _, f := range formats {
+ if format == f.flagName {
+ if f.input == nil {
+ fmt.Printf("Unrecognised input format: %v \n", format)
+ return
+ }
+ colors, err = f.input(filename)
+ if err != nil {
+ fmt.Print(err, "\n")
+ return
+ }
+ formatInMatch = true
+ break
+ }
+ }
+ if !formatInMatch {
+ fmt.Printf("Did not recognise format %v. \n", *input)
+ return
+ }
+
+ // Ensure there are 16 colors
+ if len(colors) > 16 {
+ colors = colors[:16]
+ } else if len(colors) < 16 {
+ // TODO: Should this just be a warning (for cases where only 8 colors are defined?)
+ log.Fatal("Less than 16 colors. Aborting.")
+ }
+
+ // Output the configuration specified
+ if !(*output == "") {
+ formatOutMatch := false
+ for _, f := range formats {
+ if *output == f.flagName {
+ if f.output == nil {
+ fmt.Printf("Unrecognised output format: %v \n", format)
+ return
+ }
+ fmt.Print(f.output(colors))
+ formatOutMatch = true
+ break
+ }
+ }
+ if !formatOutMatch {
+ fmt.Printf("Did not recognise format %v. \n", *output)
+ }
+ }
+
+ if *imageout != "" {
+ file, err := os.OpenFile(*imageout, os.O_CREATE|os.O_WRONLY, 0666)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer file.Close()
+
+ img := imageFromColors(colors, *imageWidth, *imageHeight) // TODO
+
+ png.Encode(file, img)
+ }
+}
diff --git a/output.go b/output.go
new file mode 100644
index 0000000..71eff48
--- /dev/null
+++ b/output.go
@@ -0,0 +1,248 @@
+package main
+
+import (
+ "encoding/base64"
+ "encoding/hex"
+ "fmt"
+ "image/color"
+ "strconv"
+)
+
+func printXfce(colors []color.Color) string {
+ output := ""
+ output += "ColorPalette="
+ for _, c := range colors {
+ bytes := []byte{byte(c.(color.NRGBA).R), byte(c.(color.NRGBA).R), byte(c.(color.NRGBA).G), byte(c.(color.NRGBA).G), byte(c.(color.NRGBA).B), byte(c.(color.NRGBA).B)}
+ output += "#"
+ output += hex.EncodeToString(bytes)
+ output += ";"
+ }
+ output += "\n"
+
+ return output
+}
+
+func printLilyTerm(colors []color.Color) string {
+ output := ""
+ for i, c := range colors {
+ cc := c.(color.NRGBA)
+ bytes := []byte{byte(cc.R), byte(cc.G), byte(cc.B)}
+ output += "Color"
+ output += strconv.Itoa(i)
+ output += " = "
+ output += "#"
+ output += hex.EncodeToString(bytes)
+ output += "\n"
+ }
+ return output
+}
+
+func printTermite(colors []color.Color) string {
+ output := ""
+ for i, c := range colors {
+ cc := c.(color.NRGBA)
+ bytes := []byte{byte(cc.R), byte(cc.G), byte(cc.B)}
+ output += "color"
+ output += strconv.Itoa(i)
+ output += " = "
+ output += "#"
+ output += hex.EncodeToString(bytes)
+ output += "\n"
+ }
+ return output
+}
+
+func printTerminator(colors []color.Color) string {
+ output := "palette = \""
+ for i, c := range colors {
+ cc := c.(color.NRGBA)
+ bytes := []byte{byte(cc.R), byte(cc.G), byte(cc.B)}
+ if i < len(colors)-1 {
+ output += "#"
+ output += hex.EncodeToString(bytes)
+ output += ":"
+ } else if i == len(colors)-1 {
+ output += "#"
+ output += hex.EncodeToString(bytes)
+ output += "\"\n"
+ }
+ }
+ return output
+}
+
+func printXterm(colors []color.Color) string {
+ output := ""
+ output += "! Terminal colors"
+ output += "\n"
+ for i, c := range colors {
+ cc := c.(color.NRGBA)
+ bytes := []byte{byte(cc.R), byte(cc.G), byte(cc.B)}
+ output += "*color"
+ output += strconv.Itoa(i)
+ output += ": #"
+ output += hex.EncodeToString(bytes)
+ output += "\n"
+ }
+
+ return output
+}
+
+func printKonsole(colors []color.Color) string {
+ output := ""
+ for i, c := range colors {
+ cc := c.(color.NRGBA)
+ output += "[Color"
+ if i > 7 {
+ output += strconv.Itoa(i - 8)
+ output += "Intense"
+ } else {
+ output += strconv.Itoa(i)
+ }
+ output += "]\n"
+ output += "Color="
+ output += strconv.Itoa(int(cc.R)) + ","
+ output += strconv.Itoa(int(cc.G)) + ","
+ output += strconv.Itoa(int(cc.B)) + "\n"
+ output += "Transparency=false\n\n"
+ }
+
+ return output
+}
+
+func printRoxTerm(colors []color.Color) string {
+ output := "[roxterm colour scheme]\n"
+ output += "pallete_size=16\n"
+
+ for i, c := range colors {
+ cc := c.(color.NRGBA)
+ bytes := []byte{byte(cc.R), byte(cc.G), byte(cc.B)}
+ output += "color"
+ output += strconv.Itoa(i)
+ output += " = "
+ output += "#"
+ output += hex.EncodeToString(bytes)
+ output += "\n"
+ }
+
+ return output
+}
+
+func printITerm2(colors []color.Color) string {
+ output := "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ output += "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
+ output += "<plist version=\"1.0\">\n"
+ output += "<dict>\n"
+ for i, c := range colors {
+ cc := c.(color.NRGBA)
+ output += "\t<key>Ansi "
+ output += strconv.Itoa(i)
+ output += " Color</key>\n"
+ output += "\t<dict>\n"
+ output += "\t\t<key>Blue Component</key>\n"
+ output += "\t\t<real>"
+ output += strconv.FormatFloat(float64(cc.B)/255, 'f', 17, 64)
+ output += "</real>\n"
+ output += "\t\t<key>Green Component</key>\n"
+ output += "\t\t<real>"
+ output += strconv.FormatFloat(float64(cc.G)/255, 'f', 17, 64)
+ output += "</real>\n"
+ output += "\t\t<key>Red Component</key>\n"
+ output += "\t\t<real>"
+ output += strconv.FormatFloat(float64(cc.R)/255, 'f', 17, 64)
+ output += "</real>\n"
+ output += "\t</dict>\n"
+ }
+ output += "</dict>\n"
+ output += "</plist>\n"
+ return output
+}
+
+func printURxvt(colors []color.Color) string {
+ output := ""
+ for i, c := range colors {
+ cc := c.(color.NRGBA)
+ bytes := []byte{byte(cc.R), byte(cc.G), byte(cc.B)}
+ output += "URxvt*color"
+ output += strconv.Itoa(i)
+ output += ": "
+ output += "#"
+ output += hex.EncodeToString(bytes)
+ output += "\n"
+ }
+ return output
+}
+
+func printColors(colors []color.Color) string {
+ output := ""
+ for _, c := range colors {
+ cc := c.(color.NRGBA)
+ bytes := []byte{byte(cc.R), byte(cc.G), byte(cc.B)}
+ output += "#"
+ output += hex.EncodeToString(bytes)
+ output += "\n"
+ }
+ return output
+}
+func printChrome(colors []color.Color) string {
+ output := "{"
+ for i, c := range colors {
+ cc := c.(color.NRGBA)
+ bytes := []byte{byte(cc.R), byte(cc.G), byte(cc.B)}
+ output += " \""
+ output += strconv.Itoa(i)
+ output += "\""
+ output += ": "
+ output += " \""
+ output += "#"
+ output += hex.EncodeToString(bytes)
+ output += "\" "
+ if i != len(colors)-1 {
+ output += ", "
+ }
+ }
+ output += "}\n"
+ return output
+}
+
+func printOSXTerminal(colors []color.Color) string {
+ // The plist that is used by OS X's Terminal to store colours. Normally,
+ // Terminal stores the colours in a base64 encoded binary plist but it'll
+ // happily read base64 encoded xml plists which makes things easier.
+ const OSXSerializedNSColorTemplate = `<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>$archiver</key><string>NSKeyedArchiver</string><key>$objects</key><array><string>$null</string><dict><key>$class</key><dict><key>CF$UID</key><integer>2</integer></dict><key>NSColorSpace</key><integer>1</integer><key>NSRGB</key><data>%s</data></dict><dict><key>$classes</key><array><string>NSColor</string><string>NSObject</string></array><key>$classname</key><string>NSColor</string></dict></array><key>$top</key><dict><key>root</key><dict><key>CF$UID</key><integer>1</integer></dict></dict><key>$version</key><integer>100000</integer></dict></plist>`
+ OSXColorNames := map[int]string{
+ 0: "Black",
+ 1: "Red",
+ 2: "Green",
+ 3: "Yellow",
+ 4: "Blue",
+ 5: "Magenta",
+ 6: "Cyan",
+ 7: "White",
+ }
+
+ output := "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ output += "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
+ output += "<plist version=\"1.0\">\n"
+ output += "<dict>\n"
+ for i, c := range colors {
+ cc := c.(color.NRGBA)
+ output += "\t<key>ANSI"
+ if i > 7 {
+ output += "Bright" + OSXColorNames[i-8]
+ } else {
+ output += OSXColorNames[i]
+ }
+ output += "Color</key>\n"
+ output += "\t<data>\n"
+ rgbColorString := fmt.Sprintf("%.10f %.10f %.10f", float64(cc.R)/255, float64(cc.G)/255, float64(cc.B)/255)
+ serializedColor := fmt.Sprintf(OSXSerializedNSColorTemplate, base64.StdEncoding.EncodeToString([]byte(rgbColorString)))
+ output += "\t" + base64.StdEncoding.EncodeToString([]byte(serializedColor))
+ output += "\n\t</data>\n"
+ }
+
+ output += "\t<key>type</key>\n" // Need this key or Terminal says the file is corrupt
+ output += "\t<string>Window Settings</string>\n"
+ output += "</dict>\n"
+ output += "</plist>\n"
+ return output
+}
diff --git a/tests/Terminals/TestAllTerminals.sh b/tests/Terminals/TestAllTerminals.sh
new file mode 100755
index 0000000..b6d58d9
--- /dev/null
+++ b/tests/Terminals/TestAllTerminals.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+
+formats=$(
+ for i in $(ls -d */);
+ do
+ echo $i | sed 's/\///g'
+ done
+)
+
+for f in $formats;
+do
+ schemer2 -in=$f:./$f/test -outputImage=test$f.png
+done
diff --git a/tests/Terminals/lilyterm/test b/tests/Terminals/lilyterm/test
new file mode 100644
index 0000000..bf06ff8
--- /dev/null
+++ b/tests/Terminals/lilyterm/test
@@ -0,0 +1,549 @@
+[main]
+
+# Auto save settings when closing window.
+auto_save = 0
+
+# The version of this profile's format. DO NOT EDIT IT!
+version = 0.9.9
+
+# The default font name of vte terminal.
+font_name = Monospace 12
+
+# The default column of vte terminal.
+column = 80
+
+# The default row of vte terminal.
+row = 24
+
+# Use true opacity in vte box.
+# 0: do NOT use rgba, 1: force to use rgba.
+# Left it blank will enable it automatically
+# if the window manager were composited.
+# Disable it will disable transparent_window, too.
+use_rgba =
+
+# Start up with fullscreen.
+fullscreen = 0
+
+# Transparent window. Only enabled when the window manager were composited.
+transparent_window = 1
+
+# The opacity of transparent window.
+window_opacity = 0.458
+
+# The opacity of transparent window when inactive.
+# Left it blank to disable this feature.
+window_opacity_inactive = 0.200
+
+# Use transparent background.
+# It will use true transparent if the window manager were composited.
+transparent_background = 0
+
+# The saturation of transparent background.
+background_saturation = 0.150
+
+# Scroll the background image along with the text.
+scroll_background = 0
+
+# Sets a background image.
+background_image =
+
+# Confirm to execute command with -e/-x/--execute option.
+confirm_to_execute_command = 1
+
+# Don't need to confirm for executing a program if it's in the whitelist,
+# separate with <space>.
+execute_command_whitelist =
+
+# Launching executed command in a new tab instead of opening a new window.
+execute_command_in_new_tab = 1
+
+# If a program is running on foreground,
+# Don't need to confirm for terminating it if it's in the whitelist,
+# separate with <space>.
+foreground_program_whitelist = bash dash csh ksh tcsh zsh screen
+
+# If a program is running in background,
+# Don't need to confirm for terminating it if it's in the whitelist,
+# separate with <space>.
+background_program_whitelist = bash dash csh ksh tcsh zsh su
+
+# Confirm before pasting texts to vte terminal.
+confirm_to_paste = 1
+
+# If the program is running on foreground,,
+# Don't need to confirm for pasting texts to it if it's in the whitelist,
+# separate with <space>.
+paste_texts_whitelist = editor vi vim elvis nano emacs emacs23 nano joe ne mg ssh
+
+# Confirm to close multi tabs.
+confirm_to_close_multi_tabs = 0
+
+# Shows [Transparent Background], [Background Saturation]
+# [Transparent Window] and [Window Opacity] on right click menu.
+show_background_menu = 1
+
+# Shows [Change the foreground color]
+# and [Change the background color] on right click menu.
+show_color_selection_menu = 1
+
+# The normal text color used in vte terminal.
+# You may use black, #000000 or #000000000000 here.
+foreground_color = white
+
+# Sets the background color for text which is under the cursor.
+# You may use black, #000000 or #000000000000 here.
+cursor_color = cyan
+
+# The background color used in vte terminal.
+# You may use black, #000000 or #000000000000 here.
+background_color = black
+
+# Shows [Increase window size], [Decrease window size],
+# [Reset to default font/size] and [Reset to system font/size]
+# on right click menu.
+show_resize_menu = 1
+
+# The ratio when resizing font via function key <Ctrl><+> and <Ctrl><->.
+# 0: the font size is +/- 1 when resizing.
+font_resize_ratio = 0.000
+
+# The ratio when resizing window via right click menu.
+# 0: the font size is +/- 1 when resizing window.
+window_resize_ratio = 1.120
+
+# When user double clicks on a text, which character will be selected.
+word_chars = -A-Za-z0-9_.+!@&=/~%
+
+# The lines of scrollback history. -1 means unlimited (vte >= 0.22.3).
+scrollback_lines = -1
+
+# Shows scroll_bar or not.
+# 0: Never shows the scroll_bar; 1: Always shows the scroll_bar.
+# Left it blank: Hide when fullscreen, or scrollback_lines = 0.
+show_scroll_bar =
+
+# The position of scroll_bar.
+# 0: scroll_bar is on left; 1: scroll_bar is on right.
+scroll_bar_position = 1
+
+# Shows input method menu on right click menu.
+show_input_method_menu = 0
+
+# Shows change page name menu on right click menu.
+show_change_page_name_menu = 1
+
+# Shows exit menu on right click menu.
+show_exit_menu = 1
+
+# Enable hyperlink in vte terminal.
+enable_hyperlink = 1
+
+# Sets whether or not the cursor will blink in vte terminal.
+# 0: Follow GTK+ settings for cursor blinking.
+# 1: Cursor blinks.
+# 2: Cursor does not blink.
+cursor_blinks = 1
+
+# Shows copy/paste menu on right click menu.
+show_copy_paste_menu = 1
+
+# Embed the copy/paste menu to the main menu.
+embedded_copy_paste_menu = 1
+
+# Sets whether or not the terminal will beep
+# when the child outputs the "bl" sequence.
+audible_bell = 1
+
+# Sets whether or not the terminal will flash
+# when the child outputs the "bl" sequence.
+visible_bell = 0
+
+# Sets whether or not the window's urgent tag will be set
+# when the child outputs the "bl" sequence.
+urgent_bell = 1
+
+# Which string the terminal should send to an application
+# when the user presses the Delete or Backspace keys.
+# 0: VTE_ERASE_AUTO
+# 1: VTE_ERASE_ASCII_BACKSPACE
+# 2: VTE_ERASE_ASCII_DELETE
+# 3: VTE_ERASE_DELETE_SEQUENCE
+# 4: VTE_ERASE_TTY
+erase_binding = 2
+
+# Sets the shape of the cursor drawn.
+# 0: VTE_CURSOR_SHAPE_BLOCK
+# 1: VTE_CURSOR_SHAPE_IBEAM
+# 2: VTE_CURSOR_SHAPE_UNDERLINE
+cursor_shape = 0
+
+# The default locale used when initing a vte terminal.
+# You may use "zh_TW", "zh_TW.Big5", or "zh_TW.UTF-8" here.
+default_locale =
+
+# The locales list on right click menu, separate with <space>.
+# You may use "ja_JP", "ja_JP.EUC-JP", or "ja_JP.UTF-8" here.
+# You may want to use "UTF-8" here if you have no locale data installed.
+# Left it blank will disable locale and encoding select menu items.
+locales_list = UTF-8
+
+# Sets what type of terminal attempts to emulate.
+# It will also set the TERM environment.
+# Unless you are interested in this feature, always use "xterm".
+emulate_term = xterm
+
+# The environment 'VTE_CJK_WIDTH' used when initing a vte terminal.
+# 0: get via environment; 1: use narrow ideograph; 2: use wide ideograph.
+VTE_CJK_WIDTH = 1
+
+# The geometry of window when starting.
+# A reasonable example value is "80x24+0+0",
+# witch means "WIDTH x HEIGHT {+-} XOFFSET {+-} YOFFSET", and NO SPACE in it.
+# Notice that it will overwrite the default column and row settings above.
+geometry =
+
+
+[page]
+
+# The max character width of page name.
+page_width = 16
+
+# Show the tabs bar or not.
+# 0: Never shows the tabs ; 1: Always shows the tabs bar.
+# Left it blank: Hide when fullscreen, or tabs number = 1.
+show_tabs_bar =
+
+# The position of tabs bar.
+# 0: Top, 1: bottom.
+tabs_bar_position = 0
+
+# The label of tabs will fill the tab bar.
+fill_tabs_bar = 0
+
+# The page name used for a new page.
+page_name = Terminal
+
+# The page names list used for new pages, separate with <space>.
+page_names = Terminal
+
+# Reuse the page name in the page names list.
+reuse_page_names = 1
+
+# Shows a (number no) on the page name.
+page_shows_number = 1
+
+# Shows the foreground running command on the page name.
+page_shows_current_cmdline = 1
+
+# Shows the terminal's idea of what the window's title should be.
+page_shows_window_title = 1
+
+# Shows current directory on the page name.
+page_shows_current_dir = 1
+
+# Check if the running command is root privileges.
+check_root_privileges = 1
+
+# Shows current encoding on the page name.
+page_shows_encoding = 1
+
+# Bold the text of current page name.
+bold_current_page_name = 1
+
+# Bold the text of action page name.
+bold_action_page_name = 1
+
+# Shows the page name of current page on window title.
+window_title_shows_current_page = 1
+
+# Append a package name (- LilyTerm) to the window title.
+window_title_append_package_name = 1
+
+# Shows a close button [X] on current tab.
+show_close_button_on_tab = 1
+
+# Shows a close button [X] on all tabs.
+show_close_button_on_all_tabs = 0
+
+# Use colorful text on page.
+use_color_page = 1
+
+# The color used for showing Window Title on page name.
+# You may use black, #000000 or #000000000000 here.
+page_win_title_color = #9A6401
+
+# The color used for showing Running Command on page name.
+# You may use black, #000000 or #000000000000 here.
+page_cmdline_color = #1C1CDC
+
+# The color used for showing Current Dir on page name.
+# You may use black, #000000 or #000000000000 here.
+page_dir_color = #215E3E
+
+# The color used for showing Custom Tab Name on page name.
+# You may use black, #000000 or #000000000000 here.
+page_custom_color = #9C0A81
+
+# The color used for showing Root Privileges on page name.
+# You may use black, #000000 or #000000000000 here.
+page_root_color = #BE0020
+
+# The color used for showing Normal Text on page name.
+# You may use black, #000000 or #000000000000 here.
+page_normal_color = #333333
+
+
+[key]
+
+# Disable/Enable hyperlinks, function keys and right click menu.
+# Left it blank to disable this function key.
+disable_key_binding = Ctrl grave
+
+# Add a new tab.
+# Left it blank to disable this function key.
+new_tab_key = Ctrl T
+
+# Close current tab.
+# Left it blank to disable this function key.
+close_tab_key =
+
+# Rename the page name of current tab.
+# Left it blank to disable this function key.
+edit_label_key =
+
+# Find the strings matching the search regex.
+# Left it blank to disable this function key.
+find_key = Ctrl F
+
+# Find the previous string matching the search regex.
+# Left it blank to disable this function key.
+find_key_prev = Shift F3
+
+# Find the next string matching the search regex.
+# Left it blank to disable this function key.
+find_key_next = F3
+
+# Switch to prev tab.
+# Left it blank to disable this function key.
+prev_tab_key = Ctrl Page_Up
+
+# Switch to next tab.
+# Left it blank to disable this function key.
+next_tab_key = Ctrl Page_Down
+
+# Switch to first tab.
+# Left it blank to disable this function key.
+first_tab_key = Ctrl Home
+
+# Switch to last tab.
+# Left it blank to disable this function key.
+last_tab_key = Ctrl End
+
+# Move current page forward.
+# Left it blank to disable this function key.
+move_tab_forward = Ctrl bracketleft
+
+# Move current page backward.
+# Left it blank to disable this function key.
+move_tab_backward = Ctrl bracketright
+
+# Move current page to first.
+# Left it blank to disable this function key.
+move_tab_first = Ctrl Up
+
+# Move current page to last.
+# Left it blank to disable this function key.
+move_tab_last = Ctrl Down
+
+# Switch to #1 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_1 = Ctrl F1
+
+# Switch to #2 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_2 = Ctrl F2
+
+# Switch to #3 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_3 = Ctrl F3
+
+# Switch to #4 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_4 = Ctrl F4
+
+# Switch to #5 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_5 = Ctrl F5
+
+# Switch to #6 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_6 = Ctrl F6
+
+# Switch to #7 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_7 = Ctrl F7
+
+# Switch to #8 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_8 = Ctrl F8
+
+# Switch to #9 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_9 = Ctrl F9
+
+# Switch to #10 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_10 = Ctrl F10
+
+# Switch to #11 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_11 = Ctrl F11
+
+# Switch to #12 tab directly.
+# Left it blank to disable this function key.
+switch_to_tab_12 = Ctrl F12
+
+# Open a new window with current dir.
+# Left it blank to disable this function key.
+new_window =
+
+# Select all the text in the Vte Terminal box.
+# Left it blank to disable this function key.
+select_all = Ctrl O
+
+# Copy the text to clipboard.
+# Left it blank to disable this function key.
+copy_clipboard = Ctrl Delete
+
+# Paste the text in clipboard.
+# Left it blank to disable this function key.
+paste_clipboard = Ctrl Insert
+
+# Paste the text in the primary clipboard.
+# Left it blank to disable this function key.
+paste_clipboard in primary = Shift Insert
+
+# Increase the font size of current tab.
+# Left it blank to disable this function key.
+increase_font_size = Ctrl equal
+
+# Decrease the font size of current tab.
+# Left it blank to disable this function key.
+decrease_font_size = Ctrl minus
+
+# Reset the font of current tab to original size.
+# Left it blank to disable this function key.
+reset_font_size = Ctrl Return
+
+# Try to maximum the window to use all available space on your display.
+# Left it blank to disable this function key.
+max_window = Alt F11
+
+# Asks to place window in the fullscreen/unfullscreen state.
+# Left it blank to disable this function key.
+full_screen = Alt Return
+
+# Emulate a mouse scroll up event on Vte Terminal box.
+# Left it blank to disable this function key.
+scroll_up = Shift Left
+
+# Emulate a mouse scroll down event on Vte Terminal box.
+# Left it blank to disable this function key.
+scroll_down = Shift Right
+
+# Asks to scroll up 1 line on Vte Terminal box.
+# Left it blank to disable this function key.
+scroll_up_1_line = Shift Up
+
+# Asks to scroll down 1 line on Vte Terminal box.
+# Left it blank to disable this function key.
+scroll_down_1_line = Shift Down
+
+
+[color]
+
+# The main ansi color theme used in vte.
+# Possible values are linux, xterm, rxvt, and tango.
+# or left it blank to use the default settings form libvte.
+theme = solarized
+
+# Invert the ansi colors, like invert the darkred to red, darkblue to bule.
+invert_color = 0
+
+# The brightness for ansi colors used in terminal.
+brightness = 0.200
+
+# The brightness for ansi colors used in terminal when inactive.
+# Left it blank to disable this feature.
+inactive_brightness = 0.200
+
+
+Color0 = #000211
+Color1 = #bb0454
+Color2 = #32b792
+Color3 = #db9b64
+Color4 = #15547b
+Color5 = #910957
+Color6 = #81148e
+Color7 = #b4b2b2
+Color8 = #282a3b
+Color9 = #cd236d
+Color10 = #77bb99
+Color11 = #dcae7a
+Color12 = #3a6884
+Color13 = #a93678
+Color14 = #942ea0
+Color15 = #e6e6e6
+
+[command]
+
+# The parameters of the APPLICATION should be separated with <tab>, if any.
+#
+# method = {0,1,2}
+# 0: Open the hyperlink in new tab.
+# Use it if the command were using CLI, like w3m.
+# 1: Open the hyperlink with gdk_spawn_on_screen_with_pipes().
+# Use it if the command were using GUI, like firefox.
+# 2: Open the hyperlink in new window,
+# Use it if you not sure.
+#
+# VTE_CJK_WIDTH = {0,1,2}
+# 0: get via environment
+# 1: use narrow ideograph
+# 2: use wide ideograph.
+#
+# The ENVIRONS will apply to the application, separated with <tab>, too.
+#
+# The LOCALE will apply to the application as locale environs.
+# You may use "zh_TW", "zh_TW.Big5", or "zh_TW.UTF-8" here.
+# Left it blank to use the locale environs from current page.
+
+# The web browser using for http(s)://
+web_browser = firefox
+web_method = 1
+web_VTE_CJK_WIDTH = 0
+web_environ =
+web_locale =
+
+# The ftp client using for ftp(s)://
+ftp_client = firefox
+ftp_method = 1
+ftp_VTE_CJK_WIDTH = 0
+ftp_environ =
+ftp_locale =
+
+# The file manager using for file:// and [Open current directory with file manager]
+file_manager = firefox
+file_method = 1
+file_VTE_CJK_WIDTH = 0
+file_environ =
+file_locale =
+
+# The email client using for user@host
+email_client = thunderbird
+email_method = 1
+email_VTE_CJK_WIDTH = 0
+email_environ =
+email_locale =
+
diff --git a/tests/Terminals/terminator/test b/tests/Terminals/terminator/test
new file mode 100644
index 0000000..938a1ad
--- /dev/null
+++ b/tests/Terminals/terminator/test
@@ -0,0 +1,14 @@
+[global_config]
+[keybindings]
+[profiles]
+ [[default]]
+ palette = "#000000:#e93f3f:#9e6ebd:#590016:#a7fdff:#3b003b:#985659:#aaaaaa:#555555:#763f3f:#ff00fa:#ffff00:#000000:#690069:#55ffff:#ffffff"
+[layouts]
+ [[default]]
+ [[[child1]]]
+ type = Terminal
+ parent = window0
+ [[[window0]]]
+ type = Window
+ parent = ""
+[plugins]
diff --git a/tests/Terminals/termite/test b/tests/Terminals/termite/test
new file mode 100644
index 0000000..027c782
--- /dev/null
+++ b/tests/Terminals/termite/test
@@ -0,0 +1,71 @@
+[options]
+scroll_on_output = false
+scroll_on_keystroke = true
+audible_bell = false
+mouse_autohide = false
+allow_bold = true
+dynamic_title = true
+urgent_on_bell = true
+clickable_url = true
+font = Monospace 9
+scrollback_lines = 1000
+search_wrap = true
+#icon_name = terminal
+#geometry = 640x480
+
+# "system", "on" or "off"
+cursor_blink = system
+
+# "block", "underline" or "ibeam"
+cursor_shape = block
+
+# $BROWSER is used by default
+#browser = firefox
+
+# set size hints for the window
+#size_hints = false
+
+# emit escape sequences for other keys modified by Control
+#modify_other_keys = false
+
+[colors]
+#cursor = #dcdccc
+foreground = #dcdccc
+foreground_bold = #ffffff
+background = #000211
+
+# 20% background transparency (requires a compositor)
+#background = rgba(63, 63, 63, 0.8)
+
+# if unset, will reverse foreground and background
+highlight = #2f2f2f
+
+# colors from color0 to color254 can be set
+color0 = #000211
+color1 = #bb0454
+color2 = #32b792
+color3 = #db9b64
+color4 = #15547b
+color5 = #910957
+color6 = #81148e
+color7 = #b4b2b2
+color8 = #282a3b
+color9 = #cd236d
+color10 = #77bb99
+color11 = #dcae7a
+color12 = #3a6884
+color13 = #a93678
+color14 = #942ea0
+color15 = #e6e6e6
+[hints]
+#font = Monospace 12
+#foreground = #dcdccc
+#background = #3f3f3f
+#active_foreground = #e68080
+#active_background = #3f3f3f
+#padding = 2
+#border = #3f3f3f
+#border_width = 0.5
+#roundness = 2.0
+
+# vim: ft=dosini cms=#%s
diff --git a/tests/Terminals/urxvt/test b/tests/Terminals/urxvt/test
new file mode 100644
index 0000000..e7c4757
--- /dev/null
+++ b/tests/Terminals/urxvt/test
@@ -0,0 +1,66 @@
+! .Xresources 2.11.2
+! Time-stamp: <2015-02-19 14:13:07 PST xoddf2>
+
+Xft.dpi: 96
+
+! rxvt-unicode -----------------------------------------------------------------
+URxvt.termName: rxvt-unicode-256color
+
+URxvt.urgentOnBell: true
+
+URxvt.scrollBar: false
+URxvt.pointerBlank: true
+
+URxvt.background: rgba:0000/0000/0000/D8D8
+URxvt.foreground: white
+
+URxvt.color0: #000000
+URxvt.color1: #CD0000
+URxvt.color2: #00CD00
+URxvt.color3: #CDCD00
+URxvt.color4: #0000EE
+URxvt.color5: #CD00CD
+URxvt.color6: #00CDCD
+URxvt.color7: #E5E5E5
+URxvt.color8: #7F7F7F
+URxvt.color9: #FF0000
+URxvt.color10: #00FF00
+URxvt.color11: #FFFF00
+URxvt.color12: #5C5CFF
+URxvt.color13: #FF00FF
+URxvt.color14: #00FFFF
+URxvt.color15: #FFFFFF
+
+URxvt.depth: 32
+
+URxvt.font: -xos4-terminus-medium-r-*-*-14-*-*-*-*-*-*-*
+
+URxvt.perl-ext-common: keyboard-select
+URxvt.keysym.M-Escape: perl:keyboard-select:activate
+
+URxvt.geometry: 80x50
+
+! Emacs ------------------------------------------------------------------------
+Emacs.geometry: 80x50
+Emacs.menuBar: off
+Emacs.toolBar: off
+Emacs.verticalScrollBars: off
+Emacs.internalBorder: 2
+Emacs.background: black
+Emacs.foreground: white
+Emacs.font: -xos4-terminus-medium-r-*-*-14-*-*-*-*-*-*-*
+
+! xclock -----------------------------------------------------------------------
+XClock.Clock.background: black
+XClock.Clock.foreground: green
+XClock.Clock.analog: false
+XClock.Clock.update: 1
+XClock.Clock.face: Fixed-12:foundry=misc:weight=normal:slant=roman
+XClock.Clock.padding: 7
+XClock.Clock.render: true
+XClock.Clock.strftime: %a %b %d %H:%M:%S %Z %Y
+
+! xload ------------------------------------------------------------------------
+XLoad*background: black
+XLoad*foreground: white
+XLoad*highlight: red
diff --git a/tests/Terminals/xfce/test b/tests/Terminals/xfce/test
new file mode 100644
index 0000000..47c60d7
--- /dev/null
+++ b/tests/Terminals/xfce/test
@@ -0,0 +1,28 @@
+[Configuration]
+FontName=DejaVu Sans Mono 10
+MiscAlwaysShowTabs=FALSE
+MiscBell=FALSE
+MiscBordersDefault=FALSE
+MiscCursorBlinks=FALSE
+MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK
+MiscDefaultGeometry=80x20
+MiscInheritGeometry=FALSE
+MiscMenubarDefault=FALSE
+MiscMouseAutohide=FALSE
+MiscToolbarDefault=FALSE
+MiscConfirmClose=TRUE
+MiscCycleTabs=TRUE
+MiscTabCloseButtons=TRUE
+MiscTabCloseMiddleClick=TRUE
+MiscTabPosition=GTK_POS_TOP
+MiscHighlightUrls=TRUE
+ScrollingBar=TERMINAL_SCROLLBAR_NONE
+ColorForeground=#ca0fca0fca0f
+ColorBackground=#000002021111
+ColorPalette=#000002021111;#bbbb04045454;#3232b7b79292;#dbb19bb76463;#151554547b7b;#919109095757;#816814ce8e7a;#ca5aca5aca5a;#28282a2a3b3b;#cdcd23236d6d;#7777bbbb9999;#dc78aef07a0d;#3a3a68688484;#a9a936367878;#94942e2ea0a0;#e627e627e627
+ColorCursor=#93a1a1
+ColorBold=#93a1a1
+ColorBoldUseDefault=FALSE
+TabActivityColor=#dc322f
+FontAllowBold=FALSE
+
diff --git a/tests/Terminals/xterm/test b/tests/Terminals/xterm/test
new file mode 100644
index 0000000..f40609a
--- /dev/null
+++ b/tests/Terminals/xterm/test
@@ -0,0 +1,17 @@
+! Terminal colors
+*color0: #000211
+*color1: #bb0454
+*color2: #32b792
+*color3: #db9b64
+*color4: #15547b
+*color5: #910957
+*color6: #81148e
+*color7: #cacaca
+*color8: #282a3b
+*color9: #cd236d
+*color10: #77bb99
+*color11: #dcae7a
+*color12: #3a6884
+*color13: #a93678
+*color14: #942ea0
+*color15: #e6e6e6
diff --git a/tests/image/Image2Image.sh b/tests/image/Image2Image.sh
new file mode 100644
index 0000000..212decd
--- /dev/null
+++ b/tests/image/Image2Image.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+
+if (( $# < 2 ))
+then
+ echo "Error, missing parameters. Example: ./Image2Image.sh width height"
+else
+ for i in `seq 1 10`;
+ do
+ schemer2 -minBright=0 -in=img:testinput.png -outputImage=testout$i.png -w=$1 -h=$2
+ done
+fi
diff --git a/tests/image/testinput.png b/tests/image/testinput.png
new file mode 100644
index 0000000..2410c1f
--- /dev/null
+++ b/tests/image/testinput.png
Binary files differ