Documentation
¶
Index ¶
- Constants
- Variables
- func ColorizeText(text string, color uint16) string
- type ColorField
- type ColorScheme
- type Printer
- func (p *Printer) ColorPrint(text string, color ColorField)
- func (p *Printer) Colorize(text string, color ColorField) string
- func (p *Printer) Format(object interface{}) string
- func (p *Printer) Indent() string
- func (p *Printer) IndentPrint(text string)
- func (p *Printer) IndentPrintf(format string, args ...interface{})
- func (p *Printer) IsColoringEnabled() bool
- func (p *Printer) Print(text string)
- func (p *Printer) PrintFieldValue(k string, v any)
- func (p *Printer) PrintKeyValue(k, v any)
- func (p *Printer) Printf(format string, args ...interface{})
- func (p *Printer) Println(text string)
- func (p *Printer) String() string
Constants ¶
View Source
const ( Black uint16 Red Green Yellow Blue Magenta Cyan White )
View Source
const ( BackgroundBlack uint16 BackgroundRed BackgroundGreen BackgroundYellow BackgroundBlue BackgroundMagenta BackgroundCyan BackgroundWhite )
View Source
const ( // Bold flag for ColorScheme. Bold uint16 = 1<<bitsBold | NoColor )
View Source
const ( // No color NoColor uint16 = 1 << 15 )
Variables ¶
View Source
var (
DefaultOut = colorable.NewColorableStdout()
)
View Source
var ( DefaultScheme = &ColorScheme{ Bool: Cyan | Bold, Integer: Blue | Bold, Float: Magenta | Bold, String: Red, StringQuotation: Red | Bold, EscapedChar: Magenta | Bold, FieldName: Yellow, PointerAdress: Blue | Bold, Nil: Cyan | Bold, Time: Blue | Bold, StructName: Green, ObjectLength: Blue, } )
Functions ¶
func ColorizeText ¶
Types ¶
type ColorField ¶
type ColorField int
const ( BoolColor ColorField IntegerColor FloatColor StringColor StringQuotationColor EscapedCharColor FieldNameColor PointerAdressColor NilColor TimeColor StructNameColor ObjectLengthColor )
type ColorScheme ¶
type ColorScheme struct { Bool uint16 Integer uint16 Float uint16 String uint16 StringQuotation uint16 EscapedChar uint16 FieldName uint16 PointerAdress uint16 Nil uint16 Time uint16 StructName uint16 ObjectLength uint16 }
func (ColorScheme) Get ¶
func (s ColorScheme) Get(field ColorField) uint16
type Printer ¶
func NewPrinter ¶
func NewPrinter( object interface{}, colorScheme *ColorScheme, decimalUint bool, exportedOnly bool, thousandsSeparator bool, ) *Printer
func (*Printer) ColorPrint ¶
func (p *Printer) ColorPrint(text string, color ColorField)
func (*Printer) IndentPrint ¶
func (*Printer) IndentPrintf ¶
func (*Printer) IsColoringEnabled ¶
func (*Printer) PrintFieldValue ¶
func (*Printer) PrintKeyValue ¶
Click to show internal directories.
Click to hide internal directories.