rich

package module
v0.0.0-...-a6e1e06 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 5 Imported by: 0

README

go-rich

Go CLI output utils inspired by the amazing Python package rich.

This library is currently in very early development.

Printing in Color!

You can use rich.Stylize to add styles to your strings.

package main

import (
	"fmt"
	"github.com/tmr232/go-rich"
)

func main() {
	fmt.Println(rich.Stylize("[green]Hello, [#5555dd underline]World!"))
}

Will print Hello, in green, and World! in #5555dd.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stylize

func Stylize(s string) string

func StylizeE

func StylizeE(s string) (string, error)

Types

type ClosingTag

type ClosingTag string

func (ClosingTag) String

func (p ClosingTag) String() string

type OpeningTag

type OpeningTag string

func (OpeningTag) String

func (p OpeningTag) String() string

type Part

type Part interface {
	// contains filtered or unexported methods
}

type StyleTag

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

func NewStyleTag

func NewStyleTag(tag string, base termenv.Style) StyleTag

type Text

type Text string

type Token

type Token struct {
	Type    TokenType
	Literal string
}

type TokenType

type TokenType int
const (
	STRING TokenType = iota + 1
	OPEN_TAG
	CLOSE_TAG
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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