Golang terminal dashboard
Go to file
2015-02-08 12:07:18 -05:00
example Update README 2015-02-08 12:00:00 -05:00
.gitignore Initial commit 2015-02-03 09:09:27 -05:00
bar.go Add LineChart and BarChart 2015-02-07 20:19:16 -05:00
block.go Add Padding to Block 2015-02-04 16:57:24 -05:00
box.go Add gauge and list component 2015-02-03 20:56:49 -05:00
chart.go Update README 2015-02-08 12:00:00 -05:00
gauge.go Add gauge and list component 2015-02-03 20:56:49 -05:00
helper_test.go Add P tag 2015-02-03 14:13:51 -05:00
helper.go Add gauge and list component 2015-02-03 20:56:49 -05:00
LICENSE Initial commit 2015-02-03 09:09:27 -05:00
list.go Add gauge and list component 2015-02-03 20:56:49 -05:00
p.go Add gauge and list component 2015-02-03 20:56:49 -05:00
point.go Add gauge and list component 2015-02-03 20:56:49 -05:00
README.md Update README.md 2015-02-08 12:07:18 -05:00
render.go Add gauge and list component 2015-02-03 20:56:49 -05:00
sparkline.go Fixed Sparklines index out of range 2015-02-05 11:03:32 -05:00

termui

Go terminal dashboard. Inspired by blessed-contrib, but purely in Go.

Cross-platform, easy to compile, and fully-customizable.

Demo:

demo

Installation

go get github.com/gizak/termui

Usage

Each component's layout is a bit like HTML block, which has border and padding.

The Border property can be chosen to hide or display (with its border label), when it comes to display, in this case the space it takes is counted as padding space (i.e. PaddingTop=PaddingBottom=PaddingLeft=PaddingRight=1).

	import ui "github.com/gizak/termui" // <- ui shortcut, optional

	func main() {
		err := ui.Init()
		if err != nil {
			panic(err)
		}
		defer ui.Close()

		p := ui.NewP(":PRESS q TO QUIT DEMO")
		p.Height = 3
		p.Width = 50
		p.TextFgColor = ui.ColorWhite
		p.Border.Label = "Text Box"
		p.Border.FgColor = ui.ColorCyan

		g := ui.NewGauge()
		g.Percent = 50
		g.Width = 50
		g.Height = 3
		g.Y = 11
		g.Border.Label = "Gauge"
		g.BarColor = ui.ColorRed
		g.Border.FgColor = ui.ColorWhite
		g.Border.LabelFgColor = ui.ColorCyan

		ui.Render(p, g)

		// event handler...
	}

Note that components can be overlapped (I'd rather call this as a feature...), Render(rs ...Renderer) renders its args from left to right (i.e. each component's weight is arising from left to right).

Widgets

APIs are subject to change, docs will be added after 2 or 3 commits

GoDoc

godoc.

License

This library is under the MIT License