ui

package
v0.0.0-...-23e0aa0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

+build linux

Index

Constants

This section is empty.

Variables

View Source
var DarkTheme = Theme{
	TextColor:                 "white",
	FieldTextColor:            "white",
	HighlightTextColor:        "yellow",
	FieldPlaceholderTextColor: "green",
	BackgroundColor:           "black",
	FieldBackgroundColor:      "blue",
	DropdownBackgroundColor:   "grey",
}

DarkTheme represents a dark theme

View Source
var LightTheme = Theme{
	TextColor:                 "black",
	FieldTextColor:            "black",
	HighlightTextColor:        "red",
	FieldPlaceholderTextColor: "white",
	BackgroundColor:           "white",
	FieldBackgroundColor:      "lightgrey",
	DropdownBackgroundColor:   "red",
}

LightTheme represents a light theme

View Source
var Themes = map[string]*Theme{
	"dark":  &DarkTheme,
	"light": &LightTheme,
}

Themes contains the string-to-theme map

Functions

func SetConsoleTitle

func SetConsoleTitle(title string) error

SetConsoleTitle sets the console title

Types

type ModalHandler

type ModalHandler interface {
	ModalMessage(msg string)
	ModalYesNo(msg string, yes func())
}

ModalHandler is an interface that handles modal dialogs

type Page

type Page interface {
	tview.Primitive
	GetName() string
	SetSelectFunc(func())
	Select()
}

Page represents a selectable page handled by PageHandler

func NewPage

func NewPage(primitive tview.Primitive, name string) Page

NewPage returns a new Page

type PageHandler

type PageHandler struct {
	tview.Primitive
	Quit chan bool
	// contains filtered or unexported fields
}

PageHandler handles the layout of the application, pages and modal dialogs

func NewPageHandler

func NewPageHandler() *PageHandler

NewPageHandler returns a new PageHandler

func (*PageHandler) AddPage

func (ph *PageHandler) AddPage(page Page) *PageHandler

AddPage adds a publicly listed page to the frame

func (*PageHandler) InputCapture

func (ph *PageHandler) InputCapture() func(event *tcell.EventKey) *tcell.EventKey

InputCapture returns a function that handles input capture for PageHandler

func (*PageHandler) ModalMessage

func (ph *PageHandler) ModalMessage(msg string)

ModalMessage displays a modal window with a message and OK button

func (*PageHandler) ModalYesNo

func (ph *PageHandler) ModalYesNo(msg string, yes func())

ModalYesNo displays a modal dialog with a message and yes/no options

func (*PageHandler) SwitchToPage

func (ph *PageHandler) SwitchToPage(page int)

SwitchToPage switches to the page with the number 'page'

type Theme

type Theme struct {
	TextColor                 string
	FieldTextColor            string
	HighlightTextColor        string
	FieldPlaceholderTextColor string
	BackgroundColor           string
	FieldBackgroundColor      string
	DropdownBackgroundColor   string
}

Theme contains the colors used by the UI

func (*Theme) Apply

func (theme *Theme) Apply()

Apply applies the theme

Jump to

Keyboard shortcuts

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