style

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectionUp    direction = "A"
	DirectionDown  direction = "B"
	DirectionRight direction = "C"
	DirectionLeft  direction = "D"
)
View Source
const (
	OperationSave          operation = "s"
	OperationRestore       operation = "u"
	OperationClear         operation = "2J"
	OperationClearLineTail operation = "K"
	OperationHide          operation = "?25l"
	OperationDisplay       operation = "?25h"
)

Variables

View Source
var (
	RainbowColor  = [...]color{RainbowRed, RainbowOrange, RainbowYellow, RainbowGreen, RainbowCyan, RainbowBlue, RainbowPurple}
	RainbowRed    = NewColor(255, 0, 0)
	RainbowOrange = NewColor(255, 165, 0)
	RainbowYellow = NewColor(255, 255, 0)
	RainbowGreen  = NewColor(0, 255, 0)
	RainbowCyan   = NewColor(0, 255, 255)
	RainbowBlue   = NewColor(0, 0, 255)
	RainbowPurple = NewColor(128, 0, 128)
)

Functions

func Blue

func Blue(s string) string

func ColorDepth added in v1.5.11

func ColorDepth() (int, error)

func Custom added in v1.5.11

func Custom(begin, end any) func(text string) string

func EnableColor added in v1.5.11

func EnableColor() bool

func Gradient added in v1.5.11

func Gradient(text string, begin, end color) string

func Gray

func Gray(s string) string

func Green

func Green(s string) string

func LightGreen

func LightGreen(s string) string

func Move added in v1.0.6

func Move(n int, direction direction) string

func MultiLineGradient added in v1.9.3

func MultiLineGradient(text string, begin, end color) string

func MultiLineRainbow added in v1.9.3

func MultiLineRainbow(text string) string

func MultiLineRandomGradient added in v1.9.3

func MultiLineRandomGradient(text string) string

func NewColor added in v1.9.3

func NewColor(r, g, b byte) color

func Purple

func Purple(s string) string

func RGBFormat added in v1.9.3

func RGBFormat(text string, r, g, b byte) string

func Rainbow added in v1.5.11

func Rainbow(text string) string

func RandomGradient added in v1.9.3

func RandomGradient(text string) string

func Red

func Red(s string) string

func RedBackground

func RedBackground(s string) string

func SetPosition added in v1.0.6

func SetPosition(x, y int) string

func StyleFormat added in v1.0.6

func StyleFormat(s string, styles ...Style) string

func Yellow

func Yellow(s string) string

Types

type Style

type Style int
const (
	DecorationNormal Style = iota
	DecorationBold
	DecorationItalic
	DecorationUnderline
)
const (
	ColorBlack Style = 30 + iota
	ColorRed
	ColorGreen
	ColorYellow
	ColorBlue
	ColorPurple
	ColorLightGreen
	ColorGray
)
const (
	BackGroundBlack Style = 40 + iota
	BackgroundRed
	BackgroundGreen
	BackgroundYellow
	BackgroundBlue
	BackgroundPurple
	BackgroundLightGreen
	BackgroundGray
)

func (Style) String added in v1.0.6

func (d Style) String() string

Jump to

Keyboard shortcuts

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