Documentation ¶
Index ¶
- Variables
- type Powerline
- type Segment
- func (s *Segment) Color() prompt.Color
- func (s *Segment) HasChanges() bool
- func (s *Segment) Render() string
- func (s *Segment) ResetColor()
- func (s *Segment) SetColor(color prompt.Color)
- func (s *Segment) SetContent(content string, tags ...string)
- func (s *Segment) SetIcon(icon string)
- func (s *Segment) Width() int
- type Style
Constants ¶
This section is empty.
Variables ¶
var ( // StyleDefault - default Style when none provided. StyleDefault = Style{ Color: prompt.Color{ Foreground: termenv.ForegroundColor(), Background: termenv.BackgroundColor(), }, InvertSeparatorColors: false, MarginLeft: " ", MarginRight: " ", SeparatorLeft: "", SeparatorRight: "", } // StyleNonPatched assumes use of regular non-patched fonts. StyleNonPatched = Style{ Color: prompt.Color{ Foreground: termenv.ForegroundColor(), Background: termenv.BackgroundColor(), }, InvertSeparatorColors: true, MarginLeft: " ", MarginRight: " ", SeparatorLeft: "◢", SeparatorRight: "◣", } // StylePatched assumes use of patched fonts with the separator characters: // https://github.com/powerline/fonts StylePatched = Style{ Color: prompt.Color{ Foreground: termenv.ForegroundColor(), Background: termenv.BackgroundColor(), }, InvertSeparatorColors: false, MarginLeft: " ", MarginRight: " ", SeparatorLeft: "\uE0B0", SeparatorRight: "\uE0B2", } )
Functions ¶
This section is empty.
Types ¶
type Powerline ¶
type Powerline struct {
// contains filtered or unexported fields
}
Powerline helps construct a powerline like prompt with segmented contents.
func (*Powerline) AppendRight ¶
AppendRight appends the given segment to the Right side of the prompt.
func (*Powerline) AutoAdjustWidth ¶
AutoAdjustWidth turns on automatically reducing number of segments to fit the provided width.
type Segment ¶
type Segment struct {
// contains filtered or unexported fields
}
Segment contains the contents for a "segment" of data in the Powerline prompt.
func (*Segment) HasChanges ¶
HasChanges returns true if Render is going to return a different result compared to its last invocation.
func (*Segment) ResetColor ¶
func (s *Segment) ResetColor()
ResetColor resets the color of the content to defaults.
func (*Segment) SetColor ¶
SetColor sets the colors to be used for the segment. If not set, the hash of the content determines the colors.
func (*Segment) SetContent ¶
SetContent sets the text of the segment.
Normally, the client can set the color for the content using SetColor. However, in case the client doesn't do it, the color is determined automatically by hashing one of the following:
- the "tags" values
- the "content" value if no "tags" provided