Documentation
¶
Index ¶
- Constants
- Variables
- func HasFullscreenRenderer() bool
- func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, forceBlack bool, hasInputWindow bool, ...)
- func IsLightRendererSupported() bool
- func TtyIn() (*os.File, error)
- func TtyOut() (*os.File, error)
- type Attr
- type BorderCharacter
- type BorderShape
- type BorderStyle
- type Color
- type ColorAttr
- type ColorPair
- func (p ColorPair) Attr() Attr
- func (p ColorPair) Bg() Color
- func (p ColorPair) Fg() Color
- func (p ColorPair) HasBg() bool
- func (p ColorPair) Merge(other ColorPair) ColorPair
- func (p ColorPair) MergeAttr(other ColorPair) ColorPair
- func (p ColorPair) MergeNonDefault(other ColorPair) ColorPair
- func (p ColorPair) WithAttr(attr Attr) ColorPair
- type ColorTheme
- type Event
- type EventType
- type FillReturn
- type FullscreenRenderer
- func (r *FullscreenRenderer) Bell()
- func (r *FullscreenRenderer) Clear()
- func (r *FullscreenRenderer) Close()
- func (r *FullscreenRenderer) DefaultTheme() *ColorTheme
- func (r *FullscreenRenderer) GetChar() Event
- func (r *FullscreenRenderer) HideCursor()
- func (r *FullscreenRenderer) Init() error
- func (r *FullscreenRenderer) MaxX() int
- func (r *FullscreenRenderer) MaxY() int
- func (r *FullscreenRenderer) NeedScrollbarRedraw() bool
- func (r *FullscreenRenderer) NewWindow(top int, left int, width int, height int, windowType WindowType, ...) Window
- func (r *FullscreenRenderer) PassThrough(string)
- func (r *FullscreenRenderer) Pause(bool)
- func (r *FullscreenRenderer) Refresh()
- func (r *FullscreenRenderer) RefreshWindows(windows []Window)
- func (r *FullscreenRenderer) Resize(maxHeightFunc func(int) int)
- func (r *FullscreenRenderer) Resume(bool, bool)
- func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool
- func (r *FullscreenRenderer) ShowCursor()
- func (r *FullscreenRenderer) Size() TermSize
- func (r *FullscreenRenderer) Top() int
- type LightRenderer
- func (r *LightRenderer) Bell()
- func (r *LightRenderer) Clear()
- func (r *LightRenderer) Close()
- func (r *LightRenderer) DefaultTheme() *ColorTheme
- func (r *LightRenderer) GetChar() Event
- func (r *LightRenderer) HideCursor()
- func (r *LightRenderer) Init() error
- func (r *LightRenderer) MaxX() int
- func (r *LightRenderer) MaxY() int
- func (r *LightRenderer) NeedScrollbarRedraw() bool
- func (r *LightRenderer) NewWindow(top int, left int, width int, height int, windowType WindowType, ...) Window
- func (r *LightRenderer) PassThrough(str string)
- func (r *LightRenderer) Pause(clear bool)
- func (r *LightRenderer) Refresh()
- func (r *LightRenderer) RefreshWindows(windows []Window)
- func (r *LightRenderer) Resize(maxHeightFunc func(int) int)
- func (r *LightRenderer) Resume(clear bool, sigcont bool)
- func (r *LightRenderer) ShouldEmitResizeEvent() bool
- func (r *LightRenderer) ShowCursor()
- func (r *LightRenderer) Size() TermSize
- func (r *LightRenderer) Top() int
- type LightWindow
- func (w *LightWindow) CFill(fg Color, bg Color, attr Attr, text string) FillReturn
- func (w *LightWindow) CPrint(pair ColorPair, text string)
- func (w *LightWindow) DrawBorder()
- func (w *LightWindow) DrawHBorder()
- func (w *LightWindow) Enclose(y int, x int) bool
- func (w *LightWindow) EncloseX(x int) bool
- func (w *LightWindow) EncloseY(y int) bool
- func (w *LightWindow) Erase()
- func (w *LightWindow) EraseMaybe() bool
- func (w *LightWindow) Fill(text string) FillReturn
- func (w *LightWindow) FinishFill()
- func (w *LightWindow) Height() int
- func (w *LightWindow) Left() int
- func (w *LightWindow) LinkBegin(uri string, params string)
- func (w *LightWindow) LinkEnd()
- func (w *LightWindow) Move(y int, x int)
- func (w *LightWindow) MoveAndClear(y int, x int)
- func (w *LightWindow) Print(text string)
- func (w *LightWindow) Refresh()
- func (w *LightWindow) SetWrapSign(sign string, width int)
- func (w *LightWindow) Top() int
- func (w *LightWindow) Width() int
- func (w *LightWindow) X() int
- func (w *LightWindow) Y() int
- type MouseEvent
- type Renderer
- type TermSize
- type Window
- type WindowType
Constants ¶
View Source
const ( AttrUndefined = Attr(0) AttrRegular = Attr(1 << 8) AttrClear = Attr(1 << 9) BoldForce = Attr(1 << 10) Bold = Attr(1) Dim = Attr(1 << 1) Italic = Attr(1 << 2) Underline = Attr(1 << 3) Blink = Attr(1 << 4) Blink2 = Attr(1 << 5) Reverse = Attr(1 << 6) StrikeThrough = Attr(1 << 7) )
View Source
const CR string = DIM + "␍"
View Source
const DIM string = "\x1b[2m"
View Source
const LF string = DIM + "␊"
Variables ¶
View Source
var ( Default16 *ColorTheme Dark256 *ColorTheme Light256 *ColorTheme ColPrompt ColorPair ColNormal ColorPair ColInput ColorPair ColDisabled ColorPair ColMatch ColorPair ColCursor ColorPair ColCursorEmpty ColorPair ColMarker ColorPair ColSelected ColorPair ColSelectedMatch ColorPair ColCurrent ColorPair ColCurrentMatch ColorPair ColCurrentCursor ColorPair ColCurrentCursorEmpty ColorPair ColCurrentMarker ColorPair ColCurrentSelectedEmpty ColorPair ColSpinner ColorPair ColInfo ColorPair ColHeader ColorPair ColHeaderBorder ColorPair ColHeaderLabel ColorPair ColSeparator ColorPair ColScrollbar ColorPair ColGapLine ColorPair ColBorder ColorPair ColPreview ColorPair ColPreviewBorder ColorPair ColBorderLabel ColorPair ColPreviewLabel ColorPair ColPreviewScrollbar ColorPair ColPreviewSpinner ColorPair ColListBorder ColorPair ColListLabel ColorPair ColInputBorder ColorPair ColInputLabel ColorPair )
View Source
var DefaultBorderShape = BorderRounded
Functions ¶
func HasFullscreenRenderer ¶
func HasFullscreenRenderer() bool
func InitTheme ¶ added in v0.58.0
func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, forceBlack bool, hasInputWindow bool, hasHeaderWindow bool)
func IsLightRendererSupported ¶
func IsLightRendererSupported() bool
Types ¶
type BorderCharacter ¶
type BorderCharacter int
type BorderShape ¶
type BorderShape int
const ( BorderUndefined BorderShape = iota BorderLine BorderNone BorderPhantom BorderRounded BorderSharp BorderBold BorderBlock BorderThinBlock BorderDouble BorderHorizontal BorderVertical BorderTop BorderBottom BorderLeft BorderRight )
func (BorderShape) HasBottom ¶ added in v0.57.0
func (s BorderShape) HasBottom() bool
func (BorderShape) HasLeft ¶
func (s BorderShape) HasLeft() bool
func (BorderShape) HasRight ¶
func (s BorderShape) HasRight() bool
func (BorderShape) HasTop ¶
func (s BorderShape) HasTop() bool
func (BorderShape) Visible ¶ added in v0.58.0
func (s BorderShape) Visible() bool
type BorderStyle ¶
type BorderStyle struct {
// contains filtered or unexported fields
}
func MakeBorderStyle ¶
func MakeBorderStyle(shape BorderShape, unicode bool) BorderStyle
type ColorAttr ¶
func NewColorAttr ¶
func NewColorAttr() ColorAttr
func (ColorAttr) IsColorDefined ¶ added in v0.58.0
type ColorPair ¶
type ColorPair struct {
// contains filtered or unexported fields
}
func (ColorPair) MergeNonDefault ¶
type ColorTheme ¶
type ColorTheme struct { Colored bool Input ColorAttr Disabled ColorAttr Fg ColorAttr Bg ColorAttr ListFg ColorAttr ListBg ColorAttr Nth ColorAttr SelectedFg ColorAttr SelectedBg ColorAttr SelectedMatch ColorAttr PreviewFg ColorAttr PreviewBg ColorAttr DarkBg ColorAttr Gutter ColorAttr Prompt ColorAttr InputBg ColorAttr InputBorder ColorAttr InputLabel ColorAttr Match ColorAttr Current ColorAttr CurrentMatch ColorAttr Spinner ColorAttr Info ColorAttr Cursor ColorAttr Marker ColorAttr Header ColorAttr HeaderBg ColorAttr HeaderBorder ColorAttr HeaderLabel ColorAttr Separator ColorAttr Scrollbar ColorAttr Border ColorAttr PreviewBorder ColorAttr PreviewLabel ColorAttr PreviewScrollbar ColorAttr BorderLabel ColorAttr ListLabel ColorAttr ListBorder ColorAttr GapLine ColorAttr }
func EmptyTheme ¶
func EmptyTheme() *ColorTheme
func NoColorTheme ¶
func NoColorTheme() *ColorTheme
type Event ¶
type Event struct { Type EventType Char rune MouseEvent *MouseEvent }
func CtrlAltKey ¶
func (Event) Comparable ¶
type EventType ¶
type EventType int
Types of user action
const ( Rune EventType = iota CtrlA CtrlB CtrlC CtrlD CtrlE CtrlF CtrlG CtrlH Tab CtrlJ CtrlK CtrlL Enter CtrlN CtrlO CtrlP CtrlQ CtrlR CtrlS CtrlT CtrlU CtrlV CtrlW CtrlX CtrlY CtrlZ Esc CtrlSpace CtrlDelete // https://apple.stackexchange.com/questions/24261/how-do-i-send-c-that-is-control-slash-to-the-terminal CtrlBackSlash CtrlRightBracket CtrlCaret CtrlSlash ShiftTab Backspace Delete PageUp PageDown Up Down Left Right Home End Insert ShiftUp ShiftDown ShiftLeft ShiftRight ShiftDelete F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 AltBackspace AltUp AltDown AltLeft AltRight AltShiftUp AltShiftDown AltShiftLeft AltShiftRight Alt CtrlAlt Invalid Fatal Mouse DoubleClick LeftClick RightClick SLeftClick SRightClick ScrollUp ScrollDown SScrollUp SScrollDown PreviewScrollUp PreviewScrollDown // Events Resize Change BackwardEOF Start Load Focus One Zero Result Jump JumpCancel ClickHeader )
type FillReturn ¶
type FillReturn int
const ( FillContinue FillReturn = iota FillNextLine FillSuspend )
type FullscreenRenderer ¶
type FullscreenRenderer struct {
// contains filtered or unexported fields
}
func (*FullscreenRenderer) Bell ¶ added in v0.59.0
func (r *FullscreenRenderer) Bell()
func (*FullscreenRenderer) Clear ¶
func (r *FullscreenRenderer) Clear()
func (*FullscreenRenderer) Close ¶
func (r *FullscreenRenderer) Close()
func (*FullscreenRenderer) DefaultTheme ¶ added in v0.58.0
func (r *FullscreenRenderer) DefaultTheme() *ColorTheme
func (*FullscreenRenderer) GetChar ¶
func (r *FullscreenRenderer) GetChar() Event
func (*FullscreenRenderer) HideCursor ¶ added in v0.59.0
func (r *FullscreenRenderer) HideCursor()
func (*FullscreenRenderer) Init ¶
func (r *FullscreenRenderer) Init() error
func (*FullscreenRenderer) MaxX ¶
func (r *FullscreenRenderer) MaxX() int
func (*FullscreenRenderer) MaxY ¶
func (r *FullscreenRenderer) MaxY() int
func (*FullscreenRenderer) NeedScrollbarRedraw ¶
func (r *FullscreenRenderer) NeedScrollbarRedraw() bool
func (*FullscreenRenderer) NewWindow ¶
func (r *FullscreenRenderer) NewWindow(top int, left int, width int, height int, windowType WindowType, borderStyle BorderStyle, erase bool) Window
func (*FullscreenRenderer) PassThrough ¶
func (r *FullscreenRenderer) PassThrough(string)
func (*FullscreenRenderer) Pause ¶
func (r *FullscreenRenderer) Pause(bool)
func (*FullscreenRenderer) Refresh ¶
func (r *FullscreenRenderer) Refresh()
func (*FullscreenRenderer) RefreshWindows ¶
func (r *FullscreenRenderer) RefreshWindows(windows []Window)
func (*FullscreenRenderer) Resize ¶
func (r *FullscreenRenderer) Resize(maxHeightFunc func(int) int)
func (*FullscreenRenderer) Resume ¶
func (r *FullscreenRenderer) Resume(bool, bool)
func (*FullscreenRenderer) ShouldEmitResizeEvent ¶
func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool
func (*FullscreenRenderer) ShowCursor ¶ added in v0.59.0
func (r *FullscreenRenderer) ShowCursor()
func (*FullscreenRenderer) Size ¶
func (r *FullscreenRenderer) Size() TermSize
func (*FullscreenRenderer) Top ¶
func (r *FullscreenRenderer) Top() int
type LightRenderer ¶
type LightRenderer struct {
// contains filtered or unexported fields
}
Light renderer
func (*LightRenderer) Bell ¶ added in v0.59.0
func (r *LightRenderer) Bell()
func (*LightRenderer) Clear ¶
func (r *LightRenderer) Clear()
func (*LightRenderer) Close ¶
func (r *LightRenderer) Close()
func (*LightRenderer) DefaultTheme ¶ added in v0.58.0
func (r *LightRenderer) DefaultTheme() *ColorTheme
func (*LightRenderer) GetChar ¶
func (r *LightRenderer) GetChar() Event
func (*LightRenderer) HideCursor ¶ added in v0.59.0
func (r *LightRenderer) HideCursor()
func (*LightRenderer) Init ¶
func (r *LightRenderer) Init() error
func (*LightRenderer) MaxX ¶
func (r *LightRenderer) MaxX() int
func (*LightRenderer) MaxY ¶
func (r *LightRenderer) MaxY() int
func (*LightRenderer) NeedScrollbarRedraw ¶
func (r *LightRenderer) NeedScrollbarRedraw() bool
func (*LightRenderer) NewWindow ¶
func (r *LightRenderer) NewWindow(top int, left int, width int, height int, windowType WindowType, borderStyle BorderStyle, erase bool) Window
func (*LightRenderer) PassThrough ¶
func (r *LightRenderer) PassThrough(str string)
func (*LightRenderer) Pause ¶
func (r *LightRenderer) Pause(clear bool)
func (*LightRenderer) Refresh ¶
func (r *LightRenderer) Refresh()
func (*LightRenderer) RefreshWindows ¶
func (r *LightRenderer) RefreshWindows(windows []Window)
func (*LightRenderer) Resize ¶
func (r *LightRenderer) Resize(maxHeightFunc func(int) int)
func (*LightRenderer) Resume ¶
func (r *LightRenderer) Resume(clear bool, sigcont bool)
func (*LightRenderer) ShouldEmitResizeEvent ¶
func (r *LightRenderer) ShouldEmitResizeEvent() bool
func (*LightRenderer) ShowCursor ¶ added in v0.59.0
func (r *LightRenderer) ShowCursor()
func (*LightRenderer) Size ¶
func (r *LightRenderer) Size() TermSize
func (*LightRenderer) Top ¶
func (r *LightRenderer) Top() int
type LightWindow ¶
type LightWindow struct {
// contains filtered or unexported fields
}
func (*LightWindow) CFill ¶
func (w *LightWindow) CFill(fg Color, bg Color, attr Attr, text string) FillReturn
func (*LightWindow) CPrint ¶
func (w *LightWindow) CPrint(pair ColorPair, text string)
func (*LightWindow) DrawBorder ¶
func (w *LightWindow) DrawBorder()
func (*LightWindow) DrawHBorder ¶
func (w *LightWindow) DrawHBorder()
func (*LightWindow) EncloseX ¶ added in v0.58.0
func (w *LightWindow) EncloseX(x int) bool
func (*LightWindow) EncloseY ¶ added in v0.58.0
func (w *LightWindow) EncloseY(y int) bool
func (*LightWindow) Erase ¶
func (w *LightWindow) Erase()
func (*LightWindow) EraseMaybe ¶
func (w *LightWindow) EraseMaybe() bool
func (*LightWindow) Fill ¶
func (w *LightWindow) Fill(text string) FillReturn
func (*LightWindow) FinishFill ¶
func (w *LightWindow) FinishFill()
func (*LightWindow) Height ¶
func (w *LightWindow) Height() int
func (*LightWindow) Left ¶
func (w *LightWindow) Left() int
func (*LightWindow) LinkBegin ¶ added in v0.55.0
func (w *LightWindow) LinkBegin(uri string, params string)
func (*LightWindow) LinkEnd ¶ added in v0.55.0
func (w *LightWindow) LinkEnd()
func (*LightWindow) Move ¶
func (w *LightWindow) Move(y int, x int)
func (*LightWindow) MoveAndClear ¶
func (w *LightWindow) MoveAndClear(y int, x int)
func (*LightWindow) Print ¶
func (w *LightWindow) Print(text string)
func (*LightWindow) Refresh ¶
func (w *LightWindow) Refresh()
func (*LightWindow) SetWrapSign ¶ added in v0.60.0
func (w *LightWindow) SetWrapSign(sign string, width int)
func (*LightWindow) Top ¶
func (w *LightWindow) Top() int
func (*LightWindow) Width ¶
func (w *LightWindow) Width() int
func (*LightWindow) X ¶
func (w *LightWindow) X() int
func (*LightWindow) Y ¶
func (w *LightWindow) Y() int
type MouseEvent ¶
type MouseEvent struct { Y int X int S int Left bool Down bool Double bool Ctrl bool Alt bool Shift bool }
func (MouseEvent) Mod ¶
func (e MouseEvent) Mod() bool
func (MouseEvent) Name ¶ added in v0.59.0
func (e MouseEvent) Name() string
type Renderer ¶
type Renderer interface { DefaultTheme() *ColorTheme Init() error Resize(maxHeightFunc func(int) int) Pause(clear bool) Resume(clear bool, sigcont bool) Clear() RefreshWindows(windows []Window) Refresh() Close() PassThrough(string) NeedScrollbarRedraw() bool ShouldEmitResizeEvent() bool Bell() HideCursor() ShowCursor() GetChar() Event Top() int MaxX() int MaxY() int Size() TermSize NewWindow(top int, left int, width int, height int, windowType WindowType, borderStyle BorderStyle, erase bool) Window }
func NewFullscreenRenderer ¶
func NewFullscreenRenderer(theme *ColorTheme, forceBlack bool, mouse bool) Renderer
type Window ¶
type Window interface { Top() int Left() int Width() int Height() int DrawBorder() DrawHBorder() Refresh() FinishFill() X() int Y() int EncloseX(x int) bool EncloseY(y int) bool Enclose(y int, x int) bool Move(y int, x int) MoveAndClear(y int, x int) Print(text string) CPrint(color ColorPair, text string) Fill(text string) FillReturn CFill(fg Color, bg Color, attr Attr, text string) FillReturn LinkBegin(uri string, params string) LinkEnd() Erase() EraseMaybe() bool SetWrapSign(string, int) }
type WindowType ¶ added in v0.58.0
type WindowType int
const ( WindowBase WindowType = iota WindowList WindowPreview WindowInput WindowHeader )
Click to show internal directories.
Click to hide internal directories.