colorize

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorStr added in v0.0.5

func ColorStr(col string, text string) string

func CopyReplace

func CopyReplace(dst io.Writer, src io.Reader, regexes []*Colorize) (written int64, err error)

func Spawn

func Spawn(colors []*Colorize, cmd string, args ...string) error

func StringToAttributes

func StringToAttributes(colorStr string) ([]color.Attribute, error)

Converts a comma separated list of colors into color.Attributes

func TestPattern added in v0.0.5

func TestPattern()

Types

type Colorize

type Colorize struct {
	ColorStr string  `yaml:"color"`
	Regexp   *Regexp `yaml:"regex"`
	Replace  []byte
	// contains filtered or unexported fields
}

The colorize struct contains a regex to match and the teminal color to replace to

func NewColorize

func NewColorize(re string, colorStr string) (*Colorize, error)

func (*Colorize) Color

func (c *Colorize) Color() *color.Color

func (*Colorize) Init

func (c *Colorize) Init() error

type Regexp

type Regexp struct {
	*regexp.Regexp
}

a Marshallable Regexp

func (*Regexp) MarshalYAML

func (re *Regexp) MarshalYAML() (interface{}, error)

implements the yaml.Marshaler interface for Regexp

func (*Regexp) UnmarshalYAML

func (re *Regexp) UnmarshalYAML(unmarshal func(interface{}) error) error

implements the yaml.Unmarshaler interface for Regexp

Jump to

Keyboard shortcuts

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