Code Monkey home page Code Monkey logo

go-rainbow's Introduction

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

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")
  • 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

Soon (send a PR to help us!):

  • Gray
  • RedBright
  • GreenBright
  • YellowBright
  • BlueBright
  • MagentaBright
  • CyanBright
  • WhiteBright

Background Colors

rainbow.BgBlue("String in Blue Background")

List

  • BgBlack
  • BgRed
  • BgGreen
  • BgYellow
  • BgBlue
  • BgMagenta
  • BgCyan
  • BgWhite

Soon (send a PR to help us!):

  • BgBlackBright
  • BgRedBright
  • BgGreenBright
  • BgYellowBright
  • BgBlueBright
  • BgMagentaBright
  • BgCyanBright
  • BgWhiteBright

Iterables

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

RGB (working on it)

rainbow.RGB(100, 110, 100)

License

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

go-rainbow's People

Contributors

raphamorim avatar scorphus avatar objectbody avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.