formatters

package
v0.0.0-...-c279acf Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2017 License: MIT, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Fallback = NoOp

Fallback formatter.

View Source
var (
	// NoOp formatter.
	NoOp = Register("noop", chroma.FormatterFunc(func(w io.Writer, s *chroma.Style, iterator chroma.Iterator) error {
		for t := iterator(); t != nil; t = iterator() {
			if _, err := io.WriteString(w, t.Value); err != nil {
				return err
			}
		}
		return nil
	}))
)
View Source
var Registry = map[string]chroma.Formatter{}

Registry of Formatters.

View Source
var TTY16m = Register("terminal16m", chroma.FormatterFunc(trueColourFormatter))

TTY16m is a true-colour terminal formatter.

View Source
var TTY256 = Register("terminal256", &indexedTTYFormatter{ttyTables[256]})

TTY256 is a 256-colour terminal formatter.

The Lab colour space is used to map RGB values to the most appropriate index colour.

View Source
var TTY8 = Register("terminal", &indexedTTYFormatter{ttyTables[8]})

TTY8 is an 8-colour terminal formatter.

The Lab colour space is used to map RGB values to the most appropriate index colour.

View Source
var Tokens = Register("tokens", chroma.FormatterFunc(func(w io.Writer, s *chroma.Style, it chroma.Iterator) error {
	for t := it(); t != nil; t = it() {
		if _, err := fmt.Fprintln(w, t.GoString()); err != nil {
			return err
		}
	}
	return nil
}))

Tokens formatter outputs the raw token structures.

Functions

func Get

func Get(name string) chroma.Formatter

Get formatter by name.

If the given formatter is not found, the Fallback formatter will be returned.

func Names

func Names() []string

Names of registered formatters.

func Register

func Register(name string, formatter chroma.Formatter) chroma.Formatter

Register a named formatter.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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