Documentation ¶
Index ¶
- Constants
- Variables
- func EraseCurrentLine()
- func EraseScreen()
- func ExampleRender()
- func ExampleShowProgressBar()
- func RenderText(text string, theme ColorTheme) string
- func RequestNewLibrary() (libraryName, libraryPath string)
- func ShowProgressBar(theme ColorTheme)
- func Start(done <-chan struct{}, outport chan<- Request) (requests chan<- Request, trackInfos chan<- string)
- type ColorTheme
- type ProgressBar
Constants ¶
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" )
const (
LOGO = `` /* 241-byte string literal not displayed */
)
Variables ¶
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 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
}