color

package module
v0.0.0-...-108f202 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2018 License: MIT Imports: 2 Imported by: 37

README

GoLang Colorized Output

GoLang colorized output library for Mac & Linux Shell, 中文版说明

Showcase

img

Install

  1. Make sure your've read GoLang Official File Structure
  2. Make sure you've set a correct GOPATH
  3. $ go get github.com/bclicn/color
  4. In your script, import "github.com/bclicn/color" then call color.Test()
  5. Use fmt.Println("Hello" + color.Red("World")) to assemble a colorized output
  6. API examples available in color-test.go

Quick (brainless) Usage

  1. Download color.go
  2. Modify its package color to package main
  3. Put your script under the same directory and write fmt.Println(Red("I'm red !!!"))
  4. Run go run color.go yourScript.go
  5. Or build by go build color.go yourScript.go

A simple test script

package main

import (
    "fmt"
    "github.com/bclicn/color"
)

func main(){
    fmt.Println(color.Red("Red output"))
    color.Test()
}

License

MIT

bcli, 2018-7-11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BBlack

func BBlack(txt string) string

black text (use this with caution since most geeks use dark console)

func BBlue

func BBlue(txt string) string

bold blue

func BCyan

func BCyan(txt string) string

bold cyan

func BDarkGray

func BDarkGray(txt string) string

bold dark gray

func BGreen

func BGreen(txt string) string

bold green

func BLightBlue

func BLightBlue(txt string) string

bold light blue

func BLightCyan

func BLightCyan(txt string) string

bold light cyan

func BLightGray

func BLightGray(txt string) string

bold light gray

func BLightGreen

func BLightGreen(txt string) string

bold light green

func BLightPurple

func BLightPurple(txt string) string

bold light purple

func BLightRed

func BLightRed(txt string) string

bold light red

func BLightYellow

func BLightYellow(txt string) string

bold light yellow

func BPurple

func BPurple(txt string) string

bold purple

func BRed

func BRed(txt string) string

bold red

func BWhite

func BWhite(txt string) string

bold white

func BYellow

func BYellow(txt string) string

bold yellow

func Black

func Black(txt string) string

black text (use this with caution since most geeks use dark console)

func Blink(txt string) string

make given text blink, not supported by all consoles

func Blue

func Blue(txt string) string

blue text

func Bold

func Bold(txt string) string

bold text

func ColorTest

func ColorTest()

func Cyan

func Cyan(txt string) string

cyan text

func DarkGray

func DarkGray(txt string) string

dark gray text

func Dim

func Dim(txt string) string

dimmed text

func GBlack

func GBlack(txt string) string

black background (use this with caution since most of geeks use dark console)

func GBlue

func GBlue(txt string) string

blue background

func GCyan

func GCyan(txt string) string

cyan background

func GDarkGray

func GDarkGray(txt string) string

dark gray background

func GGreen

func GGreen(txt string) string

green background

func GLightBlue

func GLightBlue(txt string) string

blue background

func GLightCyan

func GLightCyan(txt string) string

light cyan background

func GLightGray

func GLightGray(txt string) string

light gray background

func GLightGreen

func GLightGreen(txt string) string

light green background

func GLightPurple

func GLightPurple(txt string) string

light purple background

func GLightRed

func GLightRed(txt string) string

light red background

func GLightYellow

func GLightYellow(txt string) string

light yellow background

func GPurple

func GPurple(txt string) string

purple background

func GRed

func GRed(txt string) string

red background

func GWhite

func GWhite(txt string) string

give text a white background

func GYellow

func GYellow(txt string) string

yellow background

func Green

func Green(txt string) string

green text

func Hide

func Hide(txt string) string

hide given text, useful for password input

func Invert

func Invert(txt string) string

invert the color of text and its background

func LightBlue

func LightBlue(txt string) string

light blue text

func LightCyan

func LightCyan(txt string) string

light cyan text

func LightGray

func LightGray(txt string) string

light gray text

func LightGreen

func LightGreen(txt string) string

light green text

func LightPurple

func LightPurple(txt string) string

light purple text

func LightRed

func LightRed(txt string) string

light red text

func LightYellow

func LightYellow(txt string) string

light yellow text

func Purple

func Purple(txt string) string

purple text

func Red

func Red(txt string) string

red text

func Render

func Render(colorCode int, fontSize int, content string) string

you can use custom color code and font size by calling this function

func Test

func Test()

test all functions

func Underline

func Underline(txt string) string

underlined text

func White

func White(txt string) string

white text

func Yellow

func Yellow(txt string) string

yellow text

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL