clicolor

package
v0.0.0-...-23f0b77 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2015 License: MIT Imports: 7 Imported by: 2

Documentation

Overview

Package provides ability to print colored text on stdout

Index

Examples

Constants

This section is empty.

Variables

Will be used as first argument of fmt.Fprintln so with this you are able to redirect output stream

Functions

This section is empty.

Types

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

func Print

func Print(color string) *Printer

Provide text for printing

Example (In)
package main

import (
	cli "github.com/ivpusic/go-clicolor/clicolor"
)

func main() {
	cli.Print("this is green text").In("green")
	// prints: this is green text
}
Output:

Example (InFormat)
package main

import (
	cli "github.com/ivpusic/go-clicolor/clicolor"
)

func main() {
	cli.Print("{red}Some text in red. {white}Some text in white. {default}Some text in default color.").InFormat()
	// prints: Some text in red. Some text in white. Some text in default color.
}
Output:

func (*Printer) In

func (p *Printer) In(color string)

Printing colored text in one choosed color

func (*Printer) InFormat

func (p *Printer) InFormat()

Printing colored text based on user format User needs to provide one of supported colors Example: `this{red} is red{blue} and this is blue. {default} Now is default`

Jump to

Keyboard shortcuts

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