text

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BoxBottomLeft               = "└" // \u2514 BOX DRAWINGS LIGHT UP AND RIGHT
	BoxBottomLeftBold           = "┗" // \u2517 BOX DRAWINGS HEAVY UP AND RIGHT
	BoxBottomLeftDouble         = "╚" // \u255A BOX DRAWINGS DOUBLE UP AND RIGHT
	BoxBottomLeftRounded        = "╰" // \u2570 BOX DRAWINGS LIGHT ARC UP AND RIGHT
	BoxBottomRight              = "┘" // \u2518 BOX DRAWINGS LIGHT UP AND LEFT
	BoxBottomRightBold          = "┛" // \u251B BOX DRAWINGS HEAVY UP AND LEFT
	BoxBottomRightDouble        = "╝" // \u255D BOX DRAWINGS DOUBLE UP AND LEFT
	BoxBottomRightRounded       = "╯" // \u256F BOX DRAWINGS LIGHT ARC UP AND LEFT
	BoxBottomSeparator          = "┴" // \u2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL
	BoxBottomSeparatorBold      = "┻" // \u253B BOX DRAWINGS HEAVY UP AND HORIZONTAL
	BoxBottomSeparatorDouble    = "╩" // \u2569 BOX DRAWINGS DOUBLE UP AND HORIZONTAL
	BoxHorizontal               = "─" // \u2500 BOX DRAWINGS LIGHT HORIZONTAL
	BoxHorizontalBold           = "━" // \u2501 BOX DRAWINGS HEAVY HORIZONTAL
	BoxHorizontalDouble         = "═" // \u2550 BOX DRAWINGS DOUBLE HORIZONTAL
	BoxLeft                     = BoxVertical
	BoxLeftBold                 = BoxVerticalBold
	BoxLeftDouble               = BoxVerticalDouble
	BoxLeftSeparator            = "├" // \u251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT
	BoxLeftSeparatorBold        = "┣" // \u2523 BOX DRAWINGS HEAVY VERTICAL AND RIGHT
	BoxLeftSeparatorDouble      = "╠" // \u2560 BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
	BoxRight                    = BoxVertical
	BoxRightBold                = BoxVerticalBold
	BoxRightDouble              = BoxVerticalDouble
	BoxRightSeparator           = "┤" // \u2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT
	BoxRightSeparatorBold       = "┫" // \u252B BOX DRAWINGS HEAVY VERTICAL AND LEFT
	BoxRightSeparatorDouble     = "╣" // \u2563 BOX DRAWINGS DOUBLE VERTICAL AND LEFT
	BoxSeparator                = "┼" // \u253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
	BoxSeparatorBold            = "╋" // \u254B BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL
	BoxSeparatorDouble          = "╬" // \u256C BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
	BoxTopLeft                  = "┌" // \u250C BOX DRAWINGS LIGHT DOWN AND RIGHT
	BoxTopLeftBold              = "┏" // \u250F BOX DRAWINGS HEAVY DOWN AND RIGHT
	BoxTopLeftDouble            = "╔" // \u2554 BOX DRAWINGS DOUBLE DOWN AND RIGHT
	BoxTopLeftRounded           = "╭" // \u256D BOX DRAWINGS LIGHT ARC DOWN AND RIGHT
	BoxTopRight                 = "┐" // \u2510 BOX DRAWINGS LIGHT DOWN AND LEFT
	BoxTopRightBold             = "┓" // \u2513 BOX DRAWINGS HEAVY DOWN AND LEFT
	BoxTopRightDouble           = "╗" // \u2557 BOX DRAWINGS DOUBLE DOWN AND LEFT
	BoxTopRightRounded          = "╮" // \u256E BOX DRAWINGS LIGHT ARC DOWN AND LEFT
	BoxTopSeparator             = "┬" // \u252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
	BoxTopSeparatorBold         = "┳" // \u2533 BOX DRAWINGS HEAVY DOWN AND HORIZONTAL
	BoxTopSeparatorDouble       = "╦" // \u2566 BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
	BoxUnfinishedLine           = "≈" // \u2248 ALMOST EQUAL TO
	BoxVertical                 = "│" // \u2502 BOX DRAWINGS LIGHT VERTICAL
	BoxVerticalBold             = "┃" // \u2503 BOX DRAWINGS HEAVY VERTICAL
	BoxVerticalDouble           = "║" // \u2551 BOX DRAWINGS DOUBLE VERTICAL
	BulletCircle                = "●" // \u25CF BLACK CIRCLE
	BulletFlower                = "✽" // \u273D HEAVY TEARDROP-SPOKED ASTERISK
	BulletSquare                = "■" // \u25A0 BLACK SQUARE
	BulletStar                  = "★" // \u272E BLACK STAR
	BulletTrianglePointingDown  = "▼" // \u25BC BLACK DOWN-POINTING TRIANGLE
	BulletTrianglePointingLeft  = "◀" // \u25C0 BLACK LEFT-POINTING TRIANGLE
	BulletTrianglePointingRight = "▶" // \u25B6 BLACK RIGHT-POINTING TRIANGLE
	BulletTrianglePointingTop   = "▲" // \u25B2 BLACK UP-POINTING TRIANGLE
)

Unicode character constants for drawing borders & separators.

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

func (a Align) Apply(text string, maxLength int) string

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

func (a Align) HTMLProperty() string

HTMLProperty returns the equivalent HTML horizontal-align tag property.

func (Align) MarkdownProperty

func (a Align) MarkdownProperty() string

MarkdownProperty returns the equivalent Markdown horizontal-align separator.

type Colors

type Colors []color.Attribute

Colors represents an array of color.Attributes to define the color to render text with. Example: Colors{color.FgCyan, color.BgBlack}

func (Colors) GetColorizer

func (tc Colors) GetColorizer() *color.Color

GetColorizer returns a *color.Color object based on the color attributes set.

func (Colors) Sprint

func (tc Colors) Sprint(a ...interface{}) string

Sprint colorizes and prints the given string(s).

func (Colors) Sprintf

func (tc Colors) Sprintf(format string, a ...interface{}) string

Sprintf formats and colorizes and prints the given string(s).

type Format

type Format int

Format denotes the "case" to use for text.

const (
	FormatDefault Format = iota // default_Case
	FormatLower                 // lower
	FormatTitle                 // Title
	FormatUpper                 // UPPER
)

Format enumerations

func (Format) Apply

func (tc Format) Apply(text string) string

Apply converts the text as directed.

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

func (va VAlign) Apply(lines []string, maxLines int) []string

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

func (va VAlign) ApplyStr(text string, maxLines int) []string

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

func (va VAlign) HTMLProperty() string

HTMLProperty returns the equivalent HTML vertical-align tag property.

Jump to

Keyboard shortcuts

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