color

package module
v0.0.0-...-aaeb7bd Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 1 Imported by: 7

README

GoDoc Go Report Card License

color

Terminal color package for Go

Example

package main
  
import (
        "fmt"

        "github.com/mickep76/color"
)

func main() {
        fmt.Printf("%s%s%s%s\n", color.Red, color.Bold, "Hello World!", color.Reset)

        for i := 1; i < 255; i++ {
                fmt.Printf("%s#", color.Fg256(uint8(i)))
        }
        fmt.Printf("%s\n", color.Reset)

        for i := 1; i < 255; i++ {
                fmt.Printf("%s#", color.Bg256(uint8(i)))
        }
        fmt.Printf("%s\n", color.Reset)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bg256

func Bg256(c uint8) string

Bg256 background 256 colors

func Fg256

func Fg256(c uint8) string

Fg256 foreground 256 colors

Types

type Code

type Code int

Code color code.

const (
	Reset Code = iota
	Bold
	Dim
	Italic
	Underline
	Blink
	BlinkFast
	Inverse
	Hidden
	Strikethrough
)

Attributes.

const (
	Black Code = iota + 30
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	LightGray
)

Foreground colors.

const (
	DarkGray Code = iota + 90
	LightRed
	LightGreen
	LightYellow
	LightBlue
	LightMagenta
	LightCyan
	White
)

Foreground colors with higher offset.

const (
	BgBlack Code = iota + 40
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgLightGray
)

Background colors.

const (
	BgDarkGray Code = iota + 100
	BgLightRed
	BgLightGreen
	BgLightYellow
	BgLightBlue
	BgLightMagenta
	BgLightCyan
	BgWhite
)

Background colors with higher offset.

const None Code = -1

None color code.

func (Code) String

func (c Code) String() string

String sequence for code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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