raphamorim / go-rainbow

Golang Helper for beautiful CLI Applications
MIT License
89 stars 4 forks source link
cli colorization colors golang hex int32 rainbow rgb rgba xterm xterm256

go-rainbow Build Status

Extremely inspired by chalk.js

go-rainbow allows you to:

Sample

Available animations

Name Preview
rainbow on going...
pulse on going...
glitch on going...
radar on going...
neon rainbow

Summary

Install

go get github.com/raphamorim/go-rainbow

Example

main.go

package main
import (
    "fmt"

    "github.com/raphamorim/go-rainbow"
)

func main() {
    fmt.Println(rainbow.Bold(rainbow.Hex("#8E44AD", "raphael")))
}

go-main-example

Hex

ftm.Printf("%s", rainbow.Hex("#000080", "String from HEX")) // should be index 4 (navy blue)

FromInt32

32-bit unsigned integer equivalent (uint32)

fmt.Printf("%s", rainbow.FromInt32(0xCC66FFFF, "String from Int32"))

Modifiers

Usage

rainbow.Bold("String in Bold")

Colors

Usage

rainbow.Blue("String in Blue")

List

Soon (send a PR to help us!):

Background Colors

rainbow.BgBlue("String in Blue Background")

List

Iterables

abc := Bold(BgYellow(Blue("Bold+BgYellow+Blue")))
xyz := Dim(Underscore("Dim+Underscore"))

Animations

Animations have a different behavior of all methods, they realize the act of print, instead of only returning string.

Neon

code

rainbow.Animation("AWESOME NEON ANIMATION", "neon")

sample

rainbow

RGB (working on it)

rainbow.RGB(100, 110, 100)

License

The MIT License (MIT) - see LICENSE.md for more details