ct

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2015 License: Apache-2.0 Imports: 1 Imported by: 0

README

go-colortext package GoSearch

This is a package to change the color of the text and background in the console, working both under Windows and other systems.

Under Windows, the console APIs are used. Otherwise, ANSI texts are output.

Docs: http://godoc.org/github.com/daviddengcn/go-colortext (packages that import ct)

Usage:

ChangeColor(Red, true, White, false)
fmt.Println(...)
ChangeColor(Green, false, None, false)
fmt.Println(...)
ResetColor()

Documentation

Overview

ct package provides functions to change the color of console text.

Under windows platform, the Console api is used. Under other systems, ANSI text mode is used.

Index

Constants

View Source
const (
	// No change of color
	None = Color(iota)
	Black
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
)

Variables

This section is empty.

Functions

func ChangeColor

func ChangeColor(fg Color, fgBright bool, bg Color, bgBright bool)

ChangeColor sets the foreground and background colors. If the value of the color is None, the corresponding color keeps unchanged. If fgBright or bgBright is set true, corresponding color use bright color. bgBright may be ignored in some OS environment.

func ResetColor

func ResetColor()

ResetColor resets the foreground and background to original colors

Types

type Color

type Color int

Color is the type of color to be set.

Jump to

Keyboard shortcuts

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