text

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 136

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 added in v1.8.3

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 added in v1.8.3

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 added in v0.4.0

func Black(str string) string

func BlackBG added in v0.4.0

func BlackBG(str string) string

func Bold added in v0.4.0

func Bold(str string) string

func CC added in v0.4.0

func CC(elems ...string) string

CC concats strings

func Colorize added in v0.4.0

func Colorize(str string) string

func ColorizeBG added in v0.4.0

func ColorizeBG(str string) string

func FgBytes added in v1.8.3

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 added in v1.8.3

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 added in v0.4.0

func HashString(s string) uint64

func HighlightAnyCase added in v0.4.0

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

func HighlightLimeBG added in v0.4.0

func HighlightLimeBG(str, substr string) string

func HighlightRedBG added in v0.4.0

func HighlightRedBG(str, substr string) string

func Indigo added in v0.4.0

func Indigo(str string) string

func IndigoBG added in v0.4.0

func IndigoBG(str string) string

func IsLight added in v0.4.0

func IsLight(rr, gg, bb uint64) bool

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

func Lime added in v0.4.0

func Lime(str string) string

func LimeBG added in v0.4.0

func LimeBG(str string) string

func Ln added in v0.4.0

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

func Lnsf added in v0.4.0

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

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

func LnsfI added in v0.4.0

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

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

func Orange added in v0.4.0

func Orange(str string) string

func OrangeBG added in v0.4.0

func OrangeBG(str string) string

func Purple added in v0.4.0

func Purple(str string) string

func PurpleBG added in v0.4.0

func PurpleBG(str string) string

func Red added in v0.4.0

func Red(str string) string

func RedBG added in v0.4.0

func RedBG(str string) string

func S added in v0.4.0

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

func Sf added in v0.4.0

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

func Shakespeare added in v0.4.0

func Shakespeare(str string) string

light blue?

func ShakespeareBG added in v0.4.0

func ShakespeareBG(str string) string

func StringToColor added in v0.4.0

func StringToColor(str string) func(string) string

func StringToColorBG added in v0.4.0

func StringToColorBG(str string) func(string) string

func White added in v0.4.0

func White(str string) string

func WhiteBG added in v0.4.0

func WhiteBG(str string) string

func Yellow added in v0.4.0

func Yellow(str string) string

func YellowBG added in v0.4.0

func YellowBG(str string) string

Types

type Blob

type Blob string

Blob is base64 encoded data https://github.com/EOSIO/fc/blob/0e74738e938c2fe0f36c5238dbc549665ddaef82/include/fc/variant.hpp#L47

func (Blob) Data

func (b Blob) Data() ([]byte, error)

Data returns decoded base64 data

func (Blob) String

func (b Blob) String() string

String returns the blob as a string

type Bool

type Bool bool

func (Bool) TextEncode

func (b Bool) TextEncode(encoder *Encoder, option *Option) error

type EncodableToTree added in v0.4.0

type EncodableToTree interface {
	EncodeToTree(parent treeout.Branches)
}

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 Float128

type Float128 Uint128

func (Float128) TextEncode

func (f Float128) TextEncode(encoder *Encoder, option *Option) error

type HexBytes

type HexBytes []byte

func (HexBytes) TextEncode

func (o HexBytes) TextEncode(encoder *Encoder, option *Option) error

type Int128

type Int128 Uint128

Int128

func (Int128) BigInt

func (i Int128) BigInt() *big.Int

func (Int128) DecimalString

func (i Int128) DecimalString() string

func (Int128) TextEncode

func (i Int128) TextEncode(encoder *Encoder, option *Option) error

type Int64

type Int64 int64

func (Int64) TextEncode

func (i Int64) TextEncode(encoder *Encoder, option *Option) error

type JSONFloat64

type JSONFloat64 float64

func (JSONFloat64) TextEncode

func (f JSONFloat64) TextEncode(encoder *Encoder, option *Option) error

type Option

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

type SafeString

type SafeString string

func (SafeString) TextEncode

func (ss SafeString) TextEncode(encoder *Encoder, option *Option) error

type TextEncodable

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

type TreeEncoder added in v0.4.0

type TreeEncoder struct {
	*treeout.Tree
	// contains filtered or unexported fields
}

func NewTreeEncoder added in v0.4.0

func NewTreeEncoder(w io.Writer, doc string) *TreeEncoder

func (*TreeEncoder) WriteString added in v0.4.0

func (enc *TreeEncoder) WriteString(s string) (int, error)

type Uint128

type Uint128 struct {
	Lo uint64
	Hi uint64
}

uint128

func (Uint128) BigInt

func (i Uint128) BigInt() *big.Int

func (Uint128) DecimalString

func (i Uint128) DecimalString() string

func (Uint128) TextEncode

func (i Uint128) TextEncode(encoder *Encoder, option *Option) error

type Uint64

type Uint64 uint64

func (Uint64) TextEncode

func (i Uint64) TextEncode(encoder *Encoder, option *Option) error

type Varint16

type Varint16 int16

func (Varint16) TextEncode

func (o Varint16) TextEncode(encoder *Encoder, option *Option) error

type Varint32

type Varint32 int32

func (Varint32) TextEncode

func (o Varint32) TextEncode(encoder *Encoder, option *Option) error

type Varuint16

type Varuint16 uint16

func (Varuint16) TextEncode

func (o Varuint16) TextEncode(encoder *Encoder, option *Option) error

type Varuint32

type Varuint32 uint32

func (Varuint32) TextEncode

func (o Varuint32) 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