{"id":32968438,"url":"https://github.com/termbox/termbox2","last_synced_at":"2026-01-23T06:09:40.232Z","repository":{"id":37046744,"uuid":"403806168","full_name":"termbox/termbox2","owner":"termbox","description":"terminal I/O library","archived":false,"fork":false,"pushed_at":"2026-01-02T03:38:16.000Z","size":228,"stargazers_count":621,"open_issues_count":12,"forks_count":52,"subscribers_count":15,"default_branch":"master","last_synced_at":"2026-01-07T20:35:37.018Z","etag":null,"topics":["curses","ncurses","termcap","terminal","terminfo","tui"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/termbox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-09-07T01:42:56.000Z","updated_at":"2026-01-07T17:30:47.000Z","dependencies_parsed_at":"2023-11-19T06:27:32.431Z","dependency_job_id":"d7e5ecb4-5a79-40cf-b6ac-81ca1331c075","html_url":"https://github.com/termbox/termbox2","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/termbox/termbox2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termbox%2Ftermbox2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termbox%2Ftermbox2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termbox%2Ftermbox2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termbox%2Ftermbox2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/termbox","download_url":"https://codeload.github.com/termbox/termbox2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termbox%2Ftermbox2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28681958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curses","ncurses","termcap","terminal","terminfo","tui"],"created_at":"2025-11-13T03:01:38.369Z","updated_at":"2026-01-23T06:09:40.225Z","avatar_url":"https://github.com/termbox.png","language":"C","funding_links":[],"categories":["Utilities","Table of Contents"],"sub_categories":["YAML"],"readme":"# termbox2\n\ntermbox2 is a terminal I/O library for creating TUIs. It is a slim alternative\nto the ubiquitous [ncurses](https://invisible-island.net/ncurses) library.\nUnlike ncurses, it has a tighter API, and comes with built-in support for\npopular terminals if a terminfo db is not present on the system.\n\nCompared to the [original termbox](https://github.com/termbox/termbox), it\nretains a simple API and no dependencies beyond libc, and adds stricter error\nchecking, more efficient escape sequence parsing, opt-in support for 32-bit\ncolor, extended grapheme clusters, code gen for built-in escape sequences, a\ntest suite, and more.\n\ntermbox2 is organized as a single file header library, though it is possible to\ncompile it as a stand-alone shared or static library.\n\n![keyboard demo](demo/keyboard.gif)\n\n### Synopsis\n\n```c\n#define TB_IMPL\n#include \"termbox2.h\"\n\nint main(int argc, char **argv) {\n    struct tb_event ev;\n    int y = 0;\n\n    tb_init();\n\n    tb_printf(0, y++, TB_GREEN, 0, \"hello from termbox\");\n    tb_printf(0, y++, 0, 0, \"width=%d height=%d\", tb_width(), tb_height());\n    tb_printf(0, y++, 0, 0, \"press any key...\");\n    tb_present();\n\n    tb_poll_event(\u0026ev);\n\n    y++;\n    tb_printf(0, y++, 0, 0, \"event type=%d key=%d ch=%c\", ev.type, ev.key, ev.ch);\n    tb_printf(0, y++, 0, 0, \"press any key to quit...\");\n    tb_present();\n\n    tb_poll_event(\u0026ev);\n    tb_shutdown();\n\n    return 0;\n}\n```\n\n### API\n\nThe basic API is pretty self-explanatory. Consult the header file itself for\nthe complete API and documentation.\n\n```c\nint tb_init();\nint tb_shutdown();\n\nint tb_width();\nint tb_height();\n\nint tb_clear();\nint tb_present();\n\nint tb_set_cursor(int cx, int cy);\nint tb_hide_cursor();\n\nint tb_set_cell(int x, int y, uint32_t ch, uintattr_t fg, uintattr_t bg);\n\nint tb_peek_event(struct tb_event *event, int timeout_ms);\nint tb_poll_event(struct tb_event *event);\n\nint tb_print(int x, int y, uintattr_t fg, uintattr_t bg, const char *str);\nint tb_printf(int x, int y, uintattr_t fg, uintattr_t bg, const char *fmt, ...);\n```\n\n### How to use termbox2\n\nAs mentioned above, there are two options:\n\n1. Copy (or `git submodule`) `termbox2.h` into your C project. As normal,\n   include the header file wherever you want to use `tb_*` functions, but also\n   be sure to `#define TB_IMPL` in exactly one of your source files. (This is a\n   common pattern for single file header libraries.) Ensure that feature test\n   macros `_DEFAULT_SOURCE` and `_XOPEN_SOURCE` are defined (either by defining\n   them via compiler flags or including `termbox2.h` first[^1]).\n2. Build termbox2 as a library (either `make libtermbox2.so` or\n   `make libtermbox2.a`) and link as normal. Make sure the compile-time options\n   remain the same for libtermbox2 and your application. (Alternatively, build\n   with `make lib` and use `termbox2.h.lib` instead of `termbox2.h`. This will\n   guarantee that the same `TB_LIB_OPTS`-gated compile-time options are used in\n   the library and the header file.)\n\n### Language bindings\n\nBasic FFI or ABI-compatible examples in the languages below are in the `demo/`\ndirectory. (Feel free to submit PRs for other languages.)\n\n* [D](demo/example.d)\n* [Go](demo/example.go)\n* [Nim](demo/example.nim)\n* [PHP](demo/example.php)\n* [Python](demo/example.py)\n* [Ruby](demo/example.rb)\n* [Rust](demo/example.rs)\n* [Zig](demo/example.zig)\n\nOther wrapper libraries:\n\n* [cl-termbox2 (Common Lisp)](https://github.com/garlic0x1/cl-termbox2)\n* [termbox.cr (Crystal)](https://github.com/thmisch/termbox.cr)\n* [termbox2.cr (Crystal)](https://github.com/homonoidian/termbox2.cr)\n* [Termbox.pm (Perl)](https://github.com/sanko/Termbox.pm)\n* [termbox2-hs (Haskell)](https://github.com/gatlin/termbox2-hs)\n* [termbox2-zig (Zig)](https://sr.ht/~kolunmi/termbox2-zig)\n* [termbox2-node (JavaScript)](https://github.com/RauliL/termbox2-node)\n* [letloop's termbox2 (Chez Scheme)](https://github.com/letloop/letloop/)\n* [odin-termbox2 (Odin)](https://github.com/sudokit/odin-termbox2)\n\n### Using termbox2 with other libraries\n\ntermbox2 does not contain TUI elements/widgets like input fields, checkboxes,\nscoll bars, etc. These are too complex and opinionated and better off handled\nby a separate library. Here are some widget examples built on top of termbox2:\n\n* [readline](demo/readline.c) - if all you need is a text input\n* [termbox-widgets](https://github.com/git-bruh/termbox-widgets)\n\ntermbox2 also does not contain a layout engine for the same reason. However,\nthere is at least one layout engine with termbox2 support:\n[Clay](https://github.com/nicbarker/clay).\n\n### Examples\n\n* [mle](https://github.com/adsr/mle) - flexible terminal-based text editor\n* [newsraft](https://codeberg.org/newsraft/newsraft) - feed reader for terminal\n* [ictree](https://github.com/NikitaIvanovV/ictree) - like tree but interactive\n* [lavat](https://github.com/AngelJumbo/lavat) - lava lamp for the terminal\n* [termbox-tetris](https://github.com/zacharygraber/termbox-tetris) - Tetris clone\n* [dvd-screensaver](https://github.com/yamin-shihab/dvd-screensaver) - a terminal screensaver\n* [matrix-tui](https://github.com/git-bruh/matrix-tui) - Matrix client\n* [Vgmi](https://github.com/RealMelkor/Vgmi) - Gemini client\n* [poe](https://sr.ht/~strahinja/poe/) - `.po` file editor\n* [xtxf](https://github.com/charlesrocket/xtxf) - 2D matrix screensaver\n* [chatty](https://git.spacehb.net/chatty) - chat application\n* [ly](https://codeberg.org/fairyglade/ly) - TUI display manager for Linux and BSD\n* [kew](https://codeberg.org/ravachol/kew) - terminal music player\n\n[^1]: See https://github.com/termbox/termbox2/pull/75#issuecomment-2252242269\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftermbox%2Ftermbox2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftermbox%2Ftermbox2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftermbox%2Ftermbox2/lists"}