Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Align ¶
type Align int
Align denotes how text is to be aligned horizontally.
const ( AlignDefault Align = iota // same as AlignLeft AlignLeft // "left " AlignCenter // " center " AlignJustify // "justify it" AlignRight // " right" )
Align enumerations
func (Align) Apply ¶
Apply aligns the text as directed. Examples:
- AlignDefault.Apply("Jon Snow", 12) returns "Jon Snow "
- AlignLeft.Apply("Jon Snow", 12) returns "Jon Snow "
- AlignCenter.Apply("Jon Snow", 12) returns " Jon Snow "
- AlignJustify.Apply("Jon Snow", 12) returns "Jon Snow"
- AlignRight.Apply("Jon Snow", 12) returns " Jon Snow"
func (Align) HTMLProperty ¶
HTMLProperty returns the equivalent HTML horizontal-align tag property.
func (Align) MarkdownProperty ¶
MarkdownProperty returns the equivalent Markdown horizontal-align separator.
type Color ¶
type Color int
Color represents a single color to render text with.
const ( Reset Color = iota Bold Faint Italic Underline BlinkSlow BlinkRapid ReverseVideo Concealed CrossedOut )
Base colors -- attributes in reality
Foreground text colors
const ( FgHiBlack Color = iota + 90 FgHiRed FgHiGreen FgHiYellow FgHiBlue FgHiMagenta FgHiCyan FgHiWhite )
Foreground Hi-Intensity text colors
Background text colors
const ( BgHiBlack Color = iota + 100 BgHiRed BgHiGreen BgHiYellow BgHiBlue BgHiMagenta BgHiCyan BgHiWhite )
Background Hi-Intensity text colors
func (Color) GetEscapeSeq ¶
GetEscapeSeq returns the ANSI escape sequence for the color.
type Colors ¶
type Colors []Color
Colors represents an array of Color objects to render text with. Example: Colors{FgCyan, BgBlack}
func (Colors) GetEscapeSeq ¶
GetEscapeSeq returns the ANSI escape sequence for the colors set.
type Format ¶
type Format int
Format denotes the "case" to use for text.
type VAlign ¶
type VAlign int
VAlign denotes how text is to be aligned vertically.
const ( VAlignDefault VAlign = iota // same as VAlignTop VAlignTop // "top\n\n" VAlignMiddle // "\nmiddle\n" VAlignBottom // "\n\nbottom" )
VAlign enumerations
func (VAlign) Apply ¶
Apply aligns the lines vertically. Examples:
- VAlignTop.Apply({"Game", "Of", "Thrones"}, 5) returns {"Game", "Of", "Thrones", "", ""}
- VAlignMiddle.Apply({"Game", "Of", "Thrones"}, 5) returns {"", "Game", "Of", "Thrones", ""}
- VAlignBottom.Apply({"Game", "Of", "Thrones"}, 5) returns {"", "", "Game", "Of", "Thrones"}
func (VAlign) ApplyStr ¶
ApplyStr aligns the string (of 1 or more lines) vertically. Examples:
- VAlignTop.ApplyStr("Game\nOf\nThrones", 5) returns {"Game", "Of", "Thrones", "", ""}
- VAlignMiddle.ApplyStr("Game\nOf\nThrones", 5) returns {"", "Game", "Of", "Thrones", ""}
- VAlignBottom.ApplyStr("Game\nOf\nThrones", 5) returns {"", "", "Game", "Of", "Thrones"}
func (VAlign) HTMLProperty ¶
HTMLProperty returns the equivalent HTML vertical-align tag property.