go-rainbow

Golang Helper for beautiful CLI Applications

Github星跟蹤圖

go-rainbow Build Status

Extremely inspired by chalk.js

go-rainbow allows you to:

  • Iterate modifiers and colors on a String.
  • Use HEX as you wish.
  • Use from Int as you wish.
  • Use RGB as you wish (work in progress).
  • Bring magical Rainbow on a String (work in progress).

Sample

Available animations, Name, Preview, :---------:, :------------------------------------------:, rainbow, on going..., pulse, on going..., glitch, on going..., radar, on going..., neon, rainbow, # Summary

  • Install
  • Example
  • Hex
  • FromInt32
  • Iterables
  • Modifiers
    • Bold
    • Dim
    • Italic
    • Underline
    • Reverse
    • Hidden
  • Colors
    • Black
    • Red
    • Green
    • Yellow
    • Blue
    • Magenta
    • Cyan
    • White
    • RedBright
    • GreenBright
    • YellowBright
    • BlueBright
    • MagentaBright
    • CyanBright
    • WhiteBright
  • Background Colors
    • BgBlack
    • BgRed
    • BgGreen
    • BgYellow
    • BgBlue
    • BgMagenta
    • BgCyan
    • BgWhite
    • BgBlackBright
    • BgRedBright
    • BgGreenBright
    • BgYellowBright
    • BgBlueBright
    • BgMagentaBright
    • BgCyanBright
    • BgWhiteBright
  • Animations
    • Neon

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")
  • Bold
  • Dim
  • Italic (Not widely supported)
  • Underline
  • Reverse
  • Hidden
  • Strikethrough (Not widely supported)

Colors

Usage

rainbow.Blue("String in Blue")

List

  • Black
  • Red
  • Green
  • Yellow
  • Blue
  • Magenta
  • Cyan
  • White
  • RedBright
  • GreenBright
  • YellowBright
  • BlueBright
  • MagentaBright
  • CyanBright
  • WhiteBright

Soon (send a PR to help us!):

  • Gray

Background Colors

rainbow.BgBlue("String in Blue Background")

List

  • BgBlack
  • BgRed
  • BgGreen
  • BgYellow
  • BgBlue
  • BgMagenta
  • BgCyan
  • BgWhite
  • BgBlackBright
  • BgRedBright
  • BgGreenBright
  • BgYellowBright
  • BgBlueBright
  • BgMagentaBright
  • BgCyanBright
  • BgWhiteBright

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

主要指標

概覽
名稱與所有者raphamorim/go-rainbow
主編程語言Go
編程語言Go (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2017-08-02 05:28:56
推送於2017-09-07 21:36:16
最后一次提交2017-09-07 18:36:14
發布數1
最新版本名稱v0.1.0 (發布於 2017-08-10 01:27:50)
第一版名稱v0.1.0 (發布於 2017-08-10 01:27:50)
用户参与
星數89
關注者數5
派生數4
提交數38
已啟用問題?
問題數6
打開的問題數3
拉請求數7
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?