encodtext

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EncoderColorCyan   = color.New(color.FgCyan)
	EncoderColorYellow = color.New(color.FgYellow)
	EncoderColorGreen  = color.New(color.FgGreen)
	EncoderColorWhite  = color.New(color.FgWhite)
)
View Source
var DisableColors = false

Functions

func BgBytes

func BgBytes(in []byte, r, g, b uint8) []byte

BgBytes colorizes the background of the input with the terminal color that matches the closest the RGB color.

func BgString

func BgString(in string, r, g, b uint8) string

BgString colorizes the background of the input with the terminal color that matches the closest the RGB color.

This is simply a helper for Bytes.

func Black

func Black(str string) string

func BlackBG

func BlackBG(str string) string

func Bold

func Bold(str string) string

func CC

func CC(elems ...string) string

CC concats strings

func Colorize

func Colorize(str string) string

func ColorizeBG

func ColorizeBG(str string) string

func FgBytes

func FgBytes(in []byte, r, g, b uint8) []byte

Bytes colorizes the foreground with the terminal color that matches the closest the RGB color.

func FgString

func FgString(in string, r, g, b uint8) string

FgString colorizes the foreground of the input with the terminal color that matches the closest the RGB color.

This is simply a helper for Bytes.

func HashString

func HashString(s string) uint64

func HighlightAnyCase

func HighlightAnyCase(str, substr string, colorer func(string) string) string

func HighlightLimeBG

func HighlightLimeBG(str, substr string) string

func HighlightRedBG

func HighlightRedBG(str, substr string) string

func Indigo

func Indigo(str string) string

func IndigoBG

func IndigoBG(str string) string

func IsLight

func IsLight(rr, gg, bb uint64) bool

IsLight returns whether the color is perceived to be a light color

func Lime

func Lime(str string) string

func LimeBG

func LimeBG(str string) string

func Ln

func Ln(a ...interface{}) string

func Lnsf

func Lnsf(format string, a ...interface{}) string

Lnsf is alias of fmt.Sprintln(fmt.Sprintf())

func LnsfI

func LnsfI(indent int, format string, a ...interface{}) string

LnsfI is alias of fmt.Sprintln(fmt.Sprintf())

func Orange

func Orange(str string) string

func OrangeBG

func OrangeBG(str string) string

func Purple

func Purple(str string) string

func PurpleBG

func PurpleBG(str string) string

func Red

func Red(str string) string

func RedBG

func RedBG(str string) string

func S

func S(a ...interface{}) string

func Sf

func Sf(format string, a ...interface{}) string

func Shakespeare

func Shakespeare(str string) string

light blue?

func ShakespeareBG

func ShakespeareBG(str string) string

func StringToColor

func StringToColor(str string) func(string) string

func StringToColorBG

func StringToColorBG(str string) func(string) string

func White

func White(str string) string

func WhiteBG

func WhiteBG(str string) string

func Yellow

func Yellow(str string) string

func YellowBG

func YellowBG(str string) string

Types

type Encoder

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

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(v interface{}, option *Option) (err error)

func (*Encoder) ToWriter

func (e *Encoder) ToWriter(s string, indent bool, c *color.Color) (err error)

type Option

type Option struct {
	NoTypeName bool
	// contains filtered or unexported fields
}

type TextEncodable

type TextEncodable interface {
	TextEncode(encoder *Encoder, option *Option) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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