panel

package
v0.0.0-...-ecb31cf Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	/* Cursor sequences sets the cursor position where subsequent text will begin. */
	// The cursor will move to the home position, at the upper left of the screen.
	TCCursorHome = "\033[H"
	// The cursor will move to the start of current line.
	TCCursorLineStart = "\033[64D" // actually move cursor 64 counts left(enough to the line start)

	// Erases the screen from the current line down to the bottom of the screen.
	TCEraseDown = "\033[J"
	// Erases the entire current line.
	TCEraseLine = "\033[2K"
	// Erases from the current cursor position to the start of the current line.
	TCEraseStartofLine = "\033[1K"
	// Erases from the current cursor position to the end of the current line.
	TCEraseEndofLine = "\033[K"
)
View Source
const (

)

Variables

View Source
var (
	Spring    = [2]Attribute{FgHiGreen, FgGreen}
	Autumn    = [2]Attribute{FgHiYellow, FgYellow}
	Winter    = [2]Attribute{FgHiBlue, FgBlue}
	Rose      = [2]Attribute{FgHiRed, FgHiMagenta}
	Valentine = [2]Attribute{FgHiMagenta, FgMagenta}
)

Functions

func EraseCurrentLine

func EraseCurrentLine()

EraseCurrentLine erases the entire current line and sets the cursor at the start of current line.

func EraseScreen

func EraseScreen()

EraseScreen clears the screen and sets the cursor at the upper left of the screen.

func ExampleRender

func ExampleRender()

ExampleRender shows you how to use RenderText().

func ExampleShowProgressBar

func ExampleShowProgressBar()

ExampleShowProgressBar shows you how to use ShowProgressBar().

func RenderText

func RenderText(text string, theme ColorTheme) string

RenderText rendering given text so that it looks colorful on the screen.

func RequestNewLibrary

func RequestNewLibrary() (libraryName, libraryPath string)

RequestNewLibrary occupys terminal and requests users to type a new library's path and name.

func ShowProgressBar

func ShowProgressBar(theme ColorTheme)

func Start

func Start(done <-chan struct{}, outport chan<- Request) (requests chan<- Request,
	trackInfos chan<- string)

Start starts a goroutine to listen to requests and prints track cover to the screen, it only and is the only one that controls screen(terminal).

done: anything sent in results in this goroutine's exit.

output: where goroutine sending out its requests for other routines, requires outside routines to listen to and dispatch requests.

requests: where routine receives outside requests so that it can handle them.

trackInfos: routine starts to rander and print string receiving here repeatedly until next string or a stop request arrives.

Types

type ColorTheme

type ColorTheme [2]Attribute

func RandomColorTheme

func RandomColorTheme() ColorTheme

RandomColorTheme returns a random ColorTheme.

type ProgressBar

type ProgressBar struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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