text

package
v0.0.0-...-b925a5f Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 14 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 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

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

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

func NewTreeEncoder

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

func (*TreeEncoder) WriteString

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