richtext

package module
v0.0.0-...-117f5a9 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2016 License: MIT Imports: 6 Imported by: 5 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Simple package for generating rich text, the canonical example of which is formatted text on console.

Index

Constants

View Source
const (
	None Color = 1 << 24

	Bold Flag = iota
	Underline
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnsiFormat

type AnsiFormat interface {
	Format
	MakeSprintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) string
}

type AnsiFormat8

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

func Ansi8

func Ansi8() *AnsiFormat8

func (*AnsiFormat8) ErrorLine

func (f *AnsiFormat8) ErrorLine(format string, a ...interface{})

func (*AnsiFormat8) MakePrintf

func (a *AnsiFormat8) MakePrintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) (int, error)

func (*AnsiFormat8) MakeSprintf

func (a *AnsiFormat8) MakeSprintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) string

func (*AnsiFormat8) Print

func (f *AnsiFormat8) Print(format string, a ...interface{})

func (*AnsiFormat8) PrintLine

func (f *AnsiFormat8) PrintLine(format string, a ...interface{})

func (*AnsiFormat8) WarningLine

func (f *AnsiFormat8) WarningLine(format string, a ...interface{})

type AnsiFormat24b

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

func Ansi24b

func Ansi24b() *AnsiFormat24b

func (*AnsiFormat24b) ErrorLine

func (f *AnsiFormat24b) ErrorLine(format string, a ...interface{})

func (*AnsiFormat24b) MakePrintf

func (a *AnsiFormat24b) MakePrintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) (int, error)

func (*AnsiFormat24b) MakeSprintf

func (a *AnsiFormat24b) MakeSprintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) string

func (*AnsiFormat24b) Print

func (f *AnsiFormat24b) Print(format string, a ...interface{})

func (*AnsiFormat24b) PrintLine

func (f *AnsiFormat24b) PrintLine(format string, a ...interface{})

func (*AnsiFormat24b) WarningLine

func (f *AnsiFormat24b) WarningLine(format string, a ...interface{})

type AnsiFormat256

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

func Ansi256

func Ansi256() *AnsiFormat256

func (*AnsiFormat256) ErrorLine

func (f *AnsiFormat256) ErrorLine(format string, a ...interface{})

func (*AnsiFormat256) MakePrintf

func (a *AnsiFormat256) MakePrintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) (int, error)

func (*AnsiFormat256) MakeSprintf

func (a *AnsiFormat256) MakeSprintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) string

func (*AnsiFormat256) Print

func (f *AnsiFormat256) Print(format string, a ...interface{})

func (*AnsiFormat256) PrintLine

func (f *AnsiFormat256) PrintLine(format string, a ...interface{})

func (*AnsiFormat256) WarningLine

func (f *AnsiFormat256) WarningLine(format string, a ...interface{})

type AsciiFormat

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

func Ascii

func Ascii() *AsciiFormat

func (*AsciiFormat) ErrorLine

func (f *AsciiFormat) ErrorLine(format string, a ...interface{})

func (*AsciiFormat) MakePrintf

func (a *AsciiFormat) MakePrintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) (int, error)

func (*AsciiFormat) MakeSprintf

func (a *AsciiFormat) MakeSprintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) string

func (*AsciiFormat) Print

func (f *AsciiFormat) Print(format string, a ...interface{})

func (*AsciiFormat) PrintLine

func (f *AsciiFormat) PrintLine(format string, a ...interface{})

func (*AsciiFormat) WarningLine

func (f *AsciiFormat) WarningLine(format string, a ...interface{})

type Color

type Color uint32
const (
	//x11 rgb.txt
	AliceBlue         Color = 0xF0F8FF
	AntiqueWhite      Color = 0xFAEBD7
	Aqua              Color = 0x00FFFF
	Aquamarine        Color = 0x7FFFD4
	Azure             Color = 0xF0FFFF
	Beige             Color = 0xF5F5DC
	Bisque            Color = 0xFFE4C4
	Black             Color = 0x000000
	BlanchedAlmond    Color = 0xFFEBCD
	Blue              Color = 0x0000FF
	BlueViolet        Color = 0x8A2BE2
	Brown             Color = 0xA52A2A
	Burlywood         Color = 0xDEB887
	CadetBlue         Color = 0x5F9EA0
	Chartreuse        Color = 0x7FFF00
	Chocolate         Color = 0xD2691E
	Coral             Color = 0xFF7F50
	Cornflower        Color = 0x6495ED
	Cornsilk          Color = 0xFFF8DC
	Crimson           Color = 0xDC143C
	Cyan              Color = 0x00FFFF
	DarkBlue          Color = 0x00008B
	DarkCyan          Color = 0x008B8B
	DarkGoldenrod     Color = 0xB8860B
	DarkGray          Color = 0xA9A9A9
	DarkGreen         Color = 0x006400
	DarkKhaki         Color = 0xBDB76B
	DarkMagenta       Color = 0x8B008B
	DarkOliveGreen    Color = 0x556B2F
	DarkOrange        Color = 0xFF8C00
	DarkOrchid        Color = 0x9932CC
	DarkRed           Color = 0x8B0000
	DarkSalmon        Color = 0xE9967A
	DarkSeaGreen      Color = 0x8FBC8F
	DarkSlateBlue     Color = 0x483D8B
	DarkSlateGray     Color = 0x2F4F4F
	DarkTurquoise     Color = 0x00CED1
	DarkViolet        Color = 0x9400D3
	DeepPink          Color = 0xFF1493
	DeepSkyBlue       Color = 0x00BFFF
	DimGray           Color = 0x696969
	DodgerBlue        Color = 0x1E90FF
	Firebrick         Color = 0xB22222
	FloralWhite       Color = 0xFFFAF0
	ForestGreen       Color = 0x228B22
	Fuchsia           Color = 0xFF00FF
	Gainsboro         Color = 0xDCDCDC
	GhostWhite        Color = 0xF8F8FF
	Gold              Color = 0xFFD700
	Goldenrod         Color = 0xDAA520
	Gray              Color = 0xBEBEBE
	WebGray           Color = 0x808080
	Green             Color = 0x00FF00
	WebGreen          Color = 0x008000
	GreenYellow       Color = 0xADFF2F
	Honeydew          Color = 0xF0FFF0
	HotPink           Color = 0xFF69B4
	IndianRed         Color = 0xCD5C5C
	Indigo            Color = 0x4B0082
	Ivory             Color = 0xFFFFF0
	Khaki             Color = 0xF0E68C
	Lavender          Color = 0xE6E6FA
	LavenderBlush     Color = 0xFFF0F5
	LawnGreen         Color = 0x7CFC00
	LemonChiffon      Color = 0xFFFACD
	LightBlue         Color = 0xADD8E6
	LightCoral        Color = 0xF08080
	LightCyan         Color = 0xE0FFFF
	LightGoldenrod    Color = 0xFAFAD2
	LightGray         Color = 0xD3D3D3
	LightGreen        Color = 0x90EE90
	LightPink         Color = 0xFFB6C1
	LightSalmon       Color = 0xFFA07A
	LightSeaGreen     Color = 0x20B2AA
	LightSkyBlue      Color = 0x87CEFA
	LightSlateGray    Color = 0x778899
	LightSteelBlue    Color = 0xB0C4DE
	LightYellow       Color = 0xFFFFE0
	Lime              Color = 0x00FF00
	LimeGreen         Color = 0x32CD32
	Linen             Color = 0xFAF0E6
	Magenta           Color = 0xFF00FF
	Maroon            Color = 0xB03060
	WebMaroon         Color = 0x7F0000
	MediumAquamarine  Color = 0x66CDAA
	MediumBlue        Color = 0x0000CD
	MediumOrchid      Color = 0xBA55D3
	MediumPurple      Color = 0x9370DB
	MediumSeaGreen    Color = 0x3CB371
	MediumSlateBlue   Color = 0x7B68EE
	MediumSpringGreen Color = 0x00FA9A
	MediumTurquoise   Color = 0x48D1CC
	MediumVioletRed   Color = 0xC71585
	MidnightBlue      Color = 0x191970
	MintCream         Color = 0xF5FFFA
	MistyRose         Color = 0xFFE4E1
	Moccasin          Color = 0xFFE4B5
	NavajoWhite       Color = 0xFFDEAD
	NavyBlue          Color = 0x000080
	OldLace           Color = 0xFDF5E6
	Olive             Color = 0x808000
	OliveDrab         Color = 0x6B8E23
	Orange            Color = 0xFFA500
	OrangeRed         Color = 0xFF4500
	Orchid            Color = 0xDA70D6
	PaleGoldenrod     Color = 0xEEE8AA
	PaleGreen         Color = 0x98FB98
	PaleTurquoise     Color = 0xAFEEEE
	PaleVioletRed     Color = 0xDB7093
	PapayaWhip        Color = 0xFFEFD5
	PeachPuff         Color = 0xFFDAB9
	Peru              Color = 0xCD853F
	Pink              Color = 0xFFC0CB
	Plum              Color = 0xDDA0DD
	PowderBlue        Color = 0xB0E0E6
	Purple            Color = 0xA020F0
	WebPurple         Color = 0x7F007F
	RebeccaPurple     Color = 0x663399
	Red               Color = 0xFF0000
	RosyBrown         Color = 0xBC8F8F
	RoyalBlue         Color = 0x4169E1
	SaddleBrown       Color = 0x8B4513
	Salmon            Color = 0xFA8072
	SandyBrown        Color = 0xF4A460
	SeaGreen          Color = 0x2E8B57
	Seashell          Color = 0xFFF5EE
	Sienna            Color = 0xA0522D
	Silver            Color = 0xC0C0C0
	SkyBlue           Color = 0x87CEEB
	SlateBlue         Color = 0x6A5ACD
	SlateGray         Color = 0x708090
	Snow              Color = 0xFFFAFA
	SpringGreen       Color = 0x00FF7F
	SteelBlue         Color = 0x4682B4
	Tan               Color = 0xD2B48C
	Teal              Color = 0x008080
	Thistle           Color = 0xD8BFD8
	Tomato            Color = 0xFF6347
	Turquoise         Color = 0x40E0D0
	Violet            Color = 0xEE82EE
	Wheat             Color = 0xF5DEB3
	White             Color = 0xFFFFFF
	WhiteSmoke        Color = 0xF5F5F5
	Yellow            Color = 0xFFFF00
	YellowGreen       Color = 0x9ACD32
)

func RGB

func RGB(r, g, b uint8) Color

func (Color) String

func (i Color) String() string

type DebugFormat

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

func Debug

func Debug(w io.Writer) *DebugFormat

func (*DebugFormat) ErrorLine

func (f *DebugFormat) ErrorLine(format string, a ...interface{})

func (*DebugFormat) MakePrintf

func (f *DebugFormat) MakePrintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) (int, error)

func (*DebugFormat) Print

func (f *DebugFormat) Print(format string, a ...interface{})

func (*DebugFormat) PrintLine

func (f *DebugFormat) PrintLine(format string, a ...interface{})

func (*DebugFormat) WarningLine

func (f *DebugFormat) WarningLine(format string, a ...interface{})

type Flag

type Flag int

func (Flag) String

func (i Flag) String() string

type Format

type Format interface {
	MakePrintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) (int, error)
	WarningLine(format string, a ...interface{})
	ErrorLine(format string, a ...interface{})
	PrintLine(format string, a ...interface{})
	Print(format string, a ...interface{})
}

func New

func New() Format

type SilencedFormat

type SilencedFormat struct{}

func Console

func Console() *SilencedFormat

func Silenced

func Silenced() *SilencedFormat

func (*SilencedFormat) ErrorLine

func (*SilencedFormat) ErrorLine(format string, a ...interface{})

func (*SilencedFormat) MakePrintf

func (*SilencedFormat) MakePrintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) (int, error)

func (*SilencedFormat) Print

func (*SilencedFormat) Print(format string, a ...interface{})

func (*SilencedFormat) PrintLine

func (*SilencedFormat) PrintLine(format string, a ...interface{})

func (*SilencedFormat) WarningLine

func (*SilencedFormat) WarningLine(format string, a ...interface{})

type TestFormat

type TestFormat struct{ *testing.T }

func Test

func Test(t *testing.T) *TestFormat

func (*TestFormat) ErrorLine

func (f *TestFormat) ErrorLine(format string, a ...interface{})

func (*TestFormat) MakePrintf

func (f *TestFormat) MakePrintf(fg, bg Color, flags ...Flag) func(format string, a ...interface{}) (int, error)

func (*TestFormat) Print

func (f *TestFormat) Print(format string, a ...interface{})

func (*TestFormat) PrintLine

func (f *TestFormat) PrintLine(format string, a ...interface{})

func (*TestFormat) WarningLine

func (f *TestFormat) WarningLine(format string, a ...interface{})

Jump to

Keyboard shortcuts

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