Convert Figma logo to code with AI

mum4k logotermdash

Terminal based dashboard.

2,688
134
2,688
45

Top Related Projects

Pure Go termbox implementation

13,132

Golang terminal dashboard

10,669

Terminal UI library with rich, interactive widgets — written in Golang

4,521

Tcell is an alternate terminal package, similar in some ways to termbox, but better in others.

9,827

Minimalist Go package aimed at creating Console User Interfaces.

Quick Overview

Termdash is a Go library for building terminal-based dashboards and user interfaces. It provides a flexible and customizable framework for creating interactive, real-time displays in the terminal, including charts, graphs, and other visual elements.

Pros

  • Rich set of widgets and components for building complex terminal UIs
  • Support for real-time updates and animations
  • Cross-platform compatibility (works on various operating systems)
  • Extensive documentation and examples

Cons

  • Steep learning curve for beginners
  • Limited to terminal-based interfaces (not suitable for GUI applications)
  • Requires careful management of terminal size and layout

Code Examples

  1. Creating a simple bar chart:
import (
    "github.com/mum4k/termdash"
    "github.com/mum4k/termdash/cell"
    "github.com/mum4k/termdash/container"
    "github.com/mum4k/termdash/widgets/barchart"
)

bc, _ := barchart.New(
    barchart.Values([]int{30, 50, 80, 100, 20}),
    barchart.Labels([]string{"A", "B", "C", "D", "E"}),
    barchart.BarColors([]cell.Color{
        cell.ColorRed,
        cell.ColorGreen,
        cell.ColorBlue,
        cell.ColorYellow,
        cell.ColorMagenta,
    }),
)

c, _ := container.New(t, container.Border(linestyle.Light))
c.Update("barchart", bc)
  1. Adding a text box with periodic updates:
import (
    "github.com/mum4k/termdash/widgets/textbox"
    "github.com/mum4k/termdash/terminal/tcell"
)

tb, _ := textbox.New()

go func() {
    for {
        tb.Write("Updated text")
        time.Sleep(time.Second)
    }
}()

t, _ := tcell.New()
c, _ := container.New(t, container.Border(linestyle.Light))
c.Update("textbox", tb)
  1. Creating a line chart:
import (
    "github.com/mum4k/termdash/widgets/linechart"
)

lc, _ := linechart.New(
    linechart.AxesCellOpts(cell.FgColor(cell.ColorRed)),
    linechart.YLabelCellOpts(cell.FgColor(cell.ColorGreen)),
    linechart.XLabelCellOpts(cell.FgColor(cell.ColorCyan)),
)

c, _ := container.New(t, container.Border(linestyle.Light))
c.Update("linechart", lc)

for i := 0; i < 100; i++ {
    lc.Series("first", []float64{float64(i)}, linechart.SeriesCellOpts(cell.FgColor(cell.ColorNumber(33))))
    time.Sleep(250 * time.Millisecond)
}

Getting Started

To start using Termdash, first install it using Go modules:

go get -u github.com/mum4k/termdash

Then, import the necessary packages in your Go code:

import (
    "github.com/mum4k/termdash"
    "github.com/mum4k/termdash/container"
    "github.com/mum4k/termdash/linestyle"
    "github.com/mum4k/termdash/terminal/tcell"
)

func main() {
    t, _ := tcell.New()
    defer t.Close()

    c, _ := container.New(t, container.Border(linestyle.Light))
    
    // Add your widgets and start the dashboard
    d, _ := termdash.NewDashboard(c)
    d.Run()
}

This

Competitor Comparisons

Pure Go termbox implementation

Pros of termbox-go

  • Simpler API, easier to get started for basic terminal applications
  • Lightweight with minimal dependencies
  • Cross-platform support (Windows, macOS, Linux)

Cons of termbox-go

  • Limited built-in widgets and UI components
  • Less feature-rich compared to termdash
  • Lacks advanced layout management capabilities

Code Comparison

termbox-go:

err := termbox.Init()
if err != nil {
    panic(err)
}
defer termbox.Close()
termbox.SetOutputMode(termbox.Output256)

termdash:

t, err := tcell.New()
if err != nil {
    panic(err)
}
defer t.Close()
c, err := container.New(t, container.Border(linestyle.Light))
if err != nil {
    panic(err)
}

termdash provides a more structured approach with containers and widgets, while termbox-go offers a lower-level API for direct terminal manipulation. termdash is better suited for complex terminal UIs with multiple components, whereas termbox-go is ideal for simpler applications or when more control over the terminal is needed.

13,132

Golang terminal dashboard

Pros of termui

  • More mature project with a larger community and ecosystem
  • Wider range of pre-built components and widgets
  • Simpler API for basic use cases

Cons of termui

  • Less flexible layout system compared to termdash
  • Limited support for custom widgets and advanced customization
  • Less frequent updates and maintenance

Code Comparison

termui example:

ui.NewPar("Hello World!")
ui.NewGauge()
ui.NewBarChart()

termdash example:

container.New(
    terminal,
    container.Border(linestyle.Light),
    container.BorderTitle("PRESS Q TO QUIT"),
    container.SplitVertical(
        container.Left(
            container.SplitHorizontal(
                container.Top(
                    container.Border(linestyle.Light),
                    container.BorderTitle("Bar Chart"),
                    container.PlaceWidget(barChart),
                ),
                container.Bottom(
                    container.Border(linestyle.Light),
                    container.BorderTitle("Text Box"),
                    container.PlaceWidget(textBox),
                ),
            ),
        ),
        container.Right(
            container.Border(linestyle.Light),
            container.BorderTitle("Gauge"),
            container.PlaceWidget(gauge),
        ),
    ),
)

The code comparison shows that termui has a simpler API for creating basic components, while termdash offers more control over layout and widget placement. termdash's approach allows for more complex and customizable layouts, but requires more code for setup.

10,669

Terminal UI library with rich, interactive widgets — written in Golang

Pros of tview

  • Simpler API and easier to get started with
  • More comprehensive widget set out-of-the-box
  • Better documentation and examples

Cons of tview

  • Less flexible layout system
  • Fewer customization options for individual widgets
  • Limited support for custom drawing and animations

Code Comparison

tview example:

app := tview.NewApplication()
box := tview.NewBox().SetBorder(true).SetTitle("Hello, world!")
if err := app.SetRoot(box, true).Run(); err != nil {
    panic(err)
}

termdash example:

t, err := tcell.New()
if err != nil {
    panic(err)
}
defer t.Close()

ctx, cancel := context.WithCancel(context.Background())
c, err := container.New(t, container.Border(linestyle.Light))
if err != nil {
    panic(err)
}

if err := termdash.Run(ctx, t, c, termdash.KeyboardSubscriber(quit)); err != nil {
    panic(err)
}

Both libraries offer powerful terminal UI capabilities, but tview is generally easier to use for simpler applications, while termdash provides more control and customization options for complex layouts and widgets.

4,521

Tcell is an alternate terminal package, similar in some ways to termbox, but better in others.

Pros of tcell

  • Lower-level library, offering more flexibility and control
  • Wider terminal support, including Windows
  • Potentially better performance for complex applications

Cons of tcell

  • Requires more code to create user interfaces
  • Steeper learning curve for beginners
  • Less built-in functionality for creating dashboards and widgets

Code Comparison

termdash:

container, err := container.New(t, container.Border(linestyle.Light))
if err != nil {
    panic(err)
}

tcell:

s, err := tcell.NewScreen()
if err != nil {
    log.Fatalf("%+v", err)
}
if err := s.Init(); err != nil {
    log.Fatalf("%+v", err)
}

Summary

termdash is a higher-level library built on top of tcell, providing ready-to-use components for creating terminal dashboards. It offers a more user-friendly API but with less flexibility. tcell, on the other hand, is a lower-level library that provides direct control over terminal operations, offering more flexibility but requiring more code to create complex interfaces.

Choose termdash for quick dashboard creation with pre-built widgets, or tcell for more control and customization in terminal-based applications. Consider your project requirements and development experience when deciding between the two.

9,827

Minimalist Go package aimed at creating Console User Interfaces.

Pros of gocui

  • Simpler API and easier to get started with for basic TUI applications
  • Lightweight and minimal dependencies
  • Better suited for smaller projects or quick prototypes

Cons of gocui

  • Less feature-rich compared to termdash
  • Limited built-in widgets and customization options
  • Less active development and community support

Code Comparison

gocui example:

g, err := gocui.NewGui(gocui.OutputNormal)
if err != nil {
    log.Panicln(err)
}
defer g.Close()

g.SetManagerFunc(layout)

termdash example:

t, err := terminalapi.New(terminalapi.ColorMode(terminal.ColorMode256))
if err != nil {
    panic(err)
}
defer t.Close()

c, err := container.New(t, container.Border(linestyle.Light))
if err != nil {
    panic(err)
}

termdash offers more advanced features and customization options, while gocui provides a simpler API for basic TUI applications. termdash is better suited for complex, data-driven dashboards, while gocui is ideal for simpler, menu-driven interfaces. Choose based on your project's complexity and requirements.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Doc Status Build Status Coverage Status Go Report Card License Mentioned in Awesome Go

termdashlogo

Termdash is a cross-platform customizable terminal based dashboard.

termdashdemo

The feature set is inspired by the gizak/termui project, which in turn was inspired by yaronn/blessed-contrib.

This rewrite focuses on code readability, maintainability and testability, see the design goals. It aims to achieve the following requirements. See the high-level design for more details.

Public API and status

The public API surface is documented in the wiki.

Private packages can be identified by the presence of the /private/ directory in their import path. Stability of the private packages isn't guaranteed and changes won't be backward compatible.

There might still be breaking changes to the public API, at least until the project reaches version 1.0.0. Any breaking changes will be published in the changelog.

Current feature set

  • Full support for terminal window resizing throughout the infrastructure.
  • Customizable layout, widget placement, borders, margins, padding, colors, etc.
  • Dynamic layout changes at runtime.
  • Binary tree and Grid forms of setting up the layout.
  • Focusable containers and widgets.
  • Processing of keyboard and mouse events.
  • Periodic and event driven screen redraw.
  • A library of widgets, see below.
  • UTF-8 for all text elements.
  • Drawing primitives (Go functions) for widget development with character and sub-character resolution.

Installation

To install this library, run the following:

go get -u github.com/mum4k/termdash
cd github.com/mum4k/termdash

Usage

The usage of most of these elements is demonstrated in termdashdemo.go. To execute the demo:

go run termdashdemo/termdashdemo.go

Documentation

Please refer to the Termdash wiki for all documentation and resources.

Implemented Widgets

The Button

Allows users to interact with the application, each button press runs a callback function. Run the buttondemo.

go run widgets/button/buttondemo/buttondemo.go

buttondemo

The TextInput

Allows users to interact with the application by entering, editing and submitting text data. Run the textinputdemo.

go run widgets/textinput/textinputdemo/textinputdemo.go

textinputdemo

Can be used to create text input forms that support keyboard navigation:

go run widgets/textinput/formdemo/formdemo.go

formdemo

The Gauge

Displays the progress of an operation. Run the gaugedemo.

go run widgets/gauge/gaugedemo/gaugedemo.go

gaugedemo

The Donut

Visualizes progress of an operation as a partial or a complete donut. Run the donutdemo.

go run widgets/donut/donutdemo/donutdemo.go

donutdemo

The Text

Displays text content, supports trimming and scrolling of content. Run the textdemo.

go run widgets/text/textdemo/textdemo.go

textdemo

The SparkLine

Draws a graph showing a series of values as vertical bars. The bars can have sub-cell height. Run the sparklinedemo.

go run widgets/sparkline/sparklinedemo/sparklinedemo.go

sparklinedemo

The BarChart

Displays multiple bars showing relative ratios of values. Run the barchartdemo.

go run widgets/barchart/barchartdemo/barchartdemo.go

barchartdemo

The LineChart

Displays series of values on a line chart, supports zoom triggered by mouse events. Run the linechartdemo.

go run widgets/linechart/linechartdemo/linechartdemo.go

linechartdemo

The SegmentDisplay

Displays text by simulating a 16-segment display. Run the segmentdisplaydemo.

go run widgets/segmentdisplay/segmentdisplaydemo/segmentdisplaydemo.go

segmentdisplaydemo

Contributing

If you are willing to contribute, improve the infrastructure or develop a widget, first of all Thank You! Your help is appreciated.

Please see the CONTRIBUTING.md file for guidelines related to the Google's CLA, and code review requirements.

As stated above the primary goal of this project is to develop readable, well designed code, the functionality and efficiency come second. This is achieved through detailed code reviews, design discussions and following of the design guidelines. Please familiarize yourself with these before contributing.

If you're developing a new widget, please see the widget development section.

Termdash uses this branching model. When you fork the repository, base your changes off the devel branch and the pull request should merge it back to the devel branch. Commits to the master branch are limited to releases, major bug fixes and documentation updates.

Similar projects in Go

Projects using Termdash

  • datadash: Visualize streaming or tabular data inside the terminal.
  • grafterm: Metrics dashboards visualization on the terminal.
  • perfstat: Analyze and show tips about possible bottlenecks in Linux systems.
  • gex: Cosmos SDK explorer in-terminal.
  • ali: ALI HTTP load testing tool with realtime analysis.
  • suimon: SUI blockchain explorer and monitor.

Disclaimer

This is not an official Google product.