Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Color ¶
type Color interface { String() string // contains filtered or unexported methods }
Color represents a color.
var ( Black Color = ansiColor(0) Red Color = ansiColor(1) Green Color = ansiColor(2) Yellow Color = ansiColor(3) Blue Color = ansiColor(4) Magenta Color = ansiColor(5) Cyan Color = ansiColor(6) White Color = ansiColor(7) BrightBlack Color = ansiBrightColor(0) BrightRed Color = ansiBrightColor(1) BrightGreen Color = ansiBrightColor(2) BrightYellow Color = ansiBrightColor(3) BrightBlue Color = ansiBrightColor(4) BrightMagenta Color = ansiBrightColor(5) BrightCyan Color = ansiBrightColor(6) BrightWhite Color = ansiBrightColor(7) )
Builtin ANSI colors.
func XTerm256Color ¶
XTerm256Color returns a color from the xterm 256-color palette.
type Style ¶
type Style struct { Foreground Color Background Color Bold bool Dim bool Italic bool Underlined bool Blink bool Inverse bool }
Style specifies how something (mostly a string) shall be displayed.
func ApplyStyling ¶
ApplyStyling returns a new Style with the given Styling's applied.
func StyleFromSGR ¶
StyleFromSGR builds a Style from an SGR sequence.
func (*Style) MergeFromOptions ¶
MergeFromOptions merges all recognized values from a map to the current Style.
type Styling ¶
type Styling interface {
// contains filtered or unexported methods
}
Styling specifies how to change a Style. It can also be applied to a Segment or Text.
var ( Reset Styling = reset{} FgDefault Styling = setForeground{nil} FgBlack Styling = setForeground{Black} FgRed Styling = setForeground{Red} FgGreen Styling = setForeground{Green} FgYellow Styling = setForeground{Yellow} FgBlue Styling = setForeground{Blue} FgMagenta Styling = setForeground{Magenta} FgCyan Styling = setForeground{Cyan} FgWhite Styling = setForeground{White} FgBrightBlack Styling = setForeground{BrightBlack} FgBrightRed Styling = setForeground{BrightRed} FgBrightGreen Styling = setForeground{BrightGreen} FgBrightYellow Styling = setForeground{BrightYellow} FgBrightBlue Styling = setForeground{BrightBlue} FgBrightMagenta Styling = setForeground{BrightMagenta} FgBrightCyan Styling = setForeground{BrightCyan} FgBrightWhite Styling = setForeground{BrightWhite} BgDefault Styling = setBackground{nil} BgBlack Styling = setBackground{Black} BgRed Styling = setBackground{Red} BgGreen Styling = setBackground{Green} BgYellow Styling = setBackground{Yellow} BgBlue Styling = setBackground{Blue} BgMagenta Styling = setBackground{Magenta} BgCyan Styling = setBackground{Cyan} BgWhite Styling = setBackground{White} BgBrightBlack Styling = setBackground{BrightBlack} BgBrightRed Styling = setBackground{BrightRed} BgBrightGreen Styling = setBackground{BrightGreen} BgBrightYellow Styling = setBackground{BrightYellow} BgBrightBlue Styling = setBackground{BrightBlue} BgBrightMagenta Styling = setBackground{BrightMagenta} BgBrightCyan Styling = setBackground{BrightCyan} BgBrightWhite Styling = setBackground{BrightWhite} Bold Styling = boolOn{boldField{}} Dim Styling = boolOn{dimField{}} Italic Styling = boolOn{italicField{}} Underlined Styling = boolOn{underlinedField{}} Blink Styling = boolOn{blinkField{}} Inverse Styling = boolOn{inverseField{}} NoBold Styling = boolOff{boldField{}} NoDim Styling = boolOff{dimField{}} NoItalic Styling = boolOff{italicField{}} NoUnderlined Styling = boolOff{underlinedField{}} NoBlink Styling = boolOff{blinkField{}} NoInverse Styling = boolOff{inverseField{}} ToggleBold Styling = boolToggle{boldField{}} ToggleDim Styling = boolToggle{dimField{}} ToggleItalic Styling = boolToggle{italicField{}} ToggleUnderlined Styling = boolToggle{underlinedField{}} ToggleBlink Styling = boolToggle{blinkField{}} ToggleInverse Styling = boolToggle{inverseField{}} )
Common stylings.
func ParseStyling ¶
ParseStyling parses a text representation of Styling, which are kebab case counterparts to the names of the builtin Styling's. For example, ToggleInverse is expressed as "toggle-inverse".
Multiple stylings can be joined by spaces, which is equivalent to calling Stylings.
If the given string is invalid, ParseStyling returns nil.
func StylingFromSGR ¶
StylingFromSGR builds a Style from an SGR sequence.