color

package
v1.1.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

README

color

提供了一些控制台输出格式。

常量列表

常量名 功能
Bold 设置字体为粗体。
Italic 设置字体为斜体。
Underline 设置字体带下划线。
ReverseVideo 设置字体为反色。
CrossedOut 设置字体带删除线
Black 设置文字颜色为黑色。
Red 设置文字颜色为红色。
Green 设置文字颜色为绿色。
Yellow 设置文字颜色为黄色。
Blue 设置文字颜色为蓝色。
Magenta 设置文字颜色为紫色。
Cyan 设置文字颜色为青色。
White 设置文字颜色为白色。
BgBlack 设置文字背景色为黑色。
BgRed 设置文字背景色为红色。
BgGreen 设置文字背景色为绿色。
BgYellow 设置文字背景色为黄色。
BgBlue 设置文字背景色为蓝色。
BgMagenta 设置文字背景色为紫色。
BgCyan 设置文字背景色为青色。
BgWhite 设置文字背景色为白色。

Documentation

Overview

Package color 提供了一些控制台输出格式。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute string

Attribute 控制台属性

const (
	Bold         Attribute = "1" // 粗体
	Italic       Attribute = "3" // 斜体
	Underline    Attribute = "4" // 下划线
	ReverseVideo Attribute = "7" // 反色
	CrossedOut   Attribute = "9" // 删除线
)
const (
	Black   Attribute = "30" // 黑色
	Red     Attribute = "31" // 红色
	Green   Attribute = "32" // 绿色
	Yellow  Attribute = "33" // 黄色
	Blue    Attribute = "34" // 蓝色
	Magenta Attribute = "35" // 紫色
	Cyan    Attribute = "36" // 青色
	White   Attribute = "37" // 白色
)
const (
	BgBlack   Attribute = "40" // 背景黑色
	BgRed     Attribute = "41" // 背景红色
	BgGreen   Attribute = "42" // 背景绿色
	BgYellow  Attribute = "43" // 背景黄色
	BgBlue    Attribute = "44" // 背景蓝色
	BgMagenta Attribute = "45" // 背景紫色
	BgCyan    Attribute = "46" // 背景青色
	BgWhite   Attribute = "47" // 背景白色
)

func (Attribute) Sprint

func (attr Attribute) Sprint(a ...interface{}) string

Sprint 返回根据控制台属性格式化后的字符串。

func (Attribute) Sprintf

func (attr Attribute) Sprintf(format string, a ...interface{}) string

Sprintf 返回根据控制台属性格式化后的字符串。

type Text

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

Text 控制台属性组合

func NewText

func NewText(attributes ...Attribute) *Text

NewText 返回组合的控制台属性。

func (*Text) Sprint

func (c *Text) Sprint(a ...interface{}) string

Sprint 返回根据控制台属性格式化后的字符串。

func (*Text) Sprintf

func (c *Text) Sprintf(format string, a ...interface{}) string

Sprintf 返回根据控制台属性格式化后的字符串。

Jump to

Keyboard shortcuts

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