color

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

渲染终端文本颜色背景色和显示样式

color.NewColor("text").FgColor(color.Green).Render()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fail added in v0.0.3

func Fail(texts ...string)

Fail 输出失败文字

func Success added in v0.0.3

func Success(texts ...string)

Success 输出成功提示

Types

type BgColor added in v0.0.2

type BgColor int

BgColor 背景色枚举 (Basic 40, Hi-Intensity 100)

const (
	NoBgColor BgColor = iota + 99 // 默认背景
	BgBlack                       // 黑色背景
	BgRed                         // 红色背景
	BgGreen                       // 绿色背景
	BgYellow                      // 黄色背景
	BgBlue                        // 蓝色背景
	BgMagenta                     // 洋红背景
	BgCyan                        // 青色背景
	BgWhite                       // 白色背景
)

func (BgColor) String added in v0.0.2

func (bc BgColor) String() string

String 背景色描述

type Color added in v0.0.2

type Color interface {
	FgColor(FgColor) Color // 设置前景色
	BgColor(BgColor) Color // 设置背景色
	Style(Style) Color     // 设置样式
	Content() string       // 返回渲染后文本内容
	Render()               // 输出渲染后文本内容
}

Color interface

func NewColor added in v0.0.2

func NewColor(texts ...string) Color

NewColor ...

type FgColor added in v0.0.2

type FgColor int

FgColor 前景色枚举 (Basic 30, Hi-Intensity 90)

const (
	NoColor FgColor = iota + 89 // 默认
	Black                       // 黑色
	Red                         // 红色
	Green                       // 绿色
	Yellow                      // 黄色
	Blue                        // 蓝色
	Magenta                     // 洋红
	Cyan                        // 青色
	White                       // 白色
)

func (FgColor) String added in v0.0.2

func (fc FgColor) String() string

String 前景色描述

type Style added in v0.0.2

type Style int

Style 样式枚举

const (
	NoStyle      Style = iota // 默认
	Bold                      // 加粗
	Faint                     // 弱化
	Italic                    // 斜体
	Underline                 // 下划
	BlinkSlow                 // 慢闪
	BlinkRapid                // 快闪
	ReverseVideo              // 反转
	Concealed                 // 隐藏
	CrossedOut                // 中划
)

func (Style) String added in v0.0.2

func (a Style) String() string

String 样式描述

Jump to

Keyboard shortcuts

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