Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ggerganov/imtui

ImTui: Immediate Mode Text-based User Interface C++ Library
https://github.com/ggerganov/imtui

text tui ui user-interface

Last synced: 26 days ago
JSON representation

ImTui: Immediate Mode Text-based User Interface C++ Library

Awesome Lists containing this project

README

        

imtui
=====
[![Actions Status](https://github.com/ggerganov/imtui/workflows/CI/badge.svg)](https://github.com/ggerganov/imtui/actions)
[![ImTui v1.0.4 badge][changelog-badge]][changelog]
[![Dear ImGui version badge][imgui-version-badge]](https://github.com/ocornut/imgui)

ImTui is an immediate mode text-based user interface library. Supports 256 ANSI colors and mouse/keyboard input.



ImTui basic



A very basic ImTui example

---



Slack client



Text-based client for Slack

---



Tables



Tables example

---



HNTerm



Text-based client for Hacker News

---



WTF util



Text-based configuration editor for the WTF Dashboard

## Live demo in the browser

Even though this library is supposed to be used in the terminal, for convenience here is an [Emscripten](https://emscripten.org) build to demonstrate what it looks like, by simulating a console in the browser:

- Demo 0: [imtui.ggerganov.com](https://imtui.ggerganov.com/)
- Demo 1: [hnterm.ggerganov.com](https://hnterm.ggerganov.com/)
- Demo 2: [wtf-tui.ggerganov.com](https://wtf-tui.ggerganov.com/)
- Demo 3: [slack.ggerganov.com](https://slack.ggerganov.com/)

Note: the demos work best with **Chrome**

## Details

This library is 99.9% based on the popular [Dear ImGui](https://github.com/ocornut/imgui) library. ImTui simply provides an [ncurses](https://en.wikipedia.org/wiki/Ncurses) interface in order to draw and interact with widgets in the terminal. The entire Dear ImGui interface is available out-of-the-box.

For basic usage of ImTui, check one of the available samples:

- [example-ncurses0](https://github.com/ggerganov/imtui/blob/master/examples/ncurses0/main.cpp)
- [example-emscripten0](https://github.com/ggerganov/imtui/blob/master/examples/emscripten0/main.cpp)
- [hnterm](https://github.com/ggerganov/hnterm) - a simple tool to browse Hacker News in the terminal
- [wtf-tui](https://github.com/ggerganov/wtf-tui) - text-based UI for configuring the WTF terminal dashboard
- [slack](https://github.com/ggerganov/imtui/blob/master/examples/slack) - text-based mock UI for Slack

## Building

ImTui depends only on `libncurses`

### Linux and Mac:

```bash
git clone https://github.com/ggerganov/imtui --recursive
cd imtui
mkdir build && cd build
cmake ..
make

./bin/imtui-example-ncurses0
```

### Windows:

Partial Windows support is currently available using MSYS2 + MinGW + PDCurses:

```
# install required packages in an MSYS2 terminal:
pacman -S git cmake make mingw-w64-x86_64-dlfcn mingw-w64-x86_64-gcc mingw-w64-x86_64-pdcurses mingw-w64-x86_64-curl

# build
git clone https://github.com/ggerganov/imtui --recursive
cd imtui
mkdir build && cd build
cmake ..
make

./bin/hnterm.exe
```
![](https://user-images.githubusercontent.com/1991296/103576542-fa5aef80-4edb-11eb-8340-4bd60a1f9fba.gif)
For more information, checkout the following discussion: [#19](https://github.com/ggerganov/imtui/discussions/19)

### Emscripten:

```bash
git clone https://github.com/ggerganov/imtui --recursive
cd imtui
mkdir build && cd build
emconfigure cmake ..
make
```

[changelog]: ./CHANGELOG.md
[changelog-badge]: https://img.shields.io/badge/changelog-ImTui%20v1.0.4-dummy
[imgui-version-badge]: https://img.shields.io/badge/Powered%20by%20Dear%20ImGui-v1.81-blue.svg