{"id":50527537,"url":"https://github.com/spence/opentui-core-rs","last_synced_at":"2026-06-03T09:04:02.225Z","repository":{"id":350483230,"uuid":"1206768852","full_name":"spence/opentui-core-rs","owner":"spence","description":"Rust bindings to the sst/opentui terminal rendering engine","archived":false,"fork":false,"pushed_at":"2026-04-10T14:19:21.000Z","size":910,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-10T16:17:07.528Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/spence.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":"2026-04-10T08:31:17.000Z","updated_at":"2026-04-10T14:19:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/spence/opentui-core-rs","commit_stats":null,"previous_names":["spence/opentui-core-rs"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/spence/opentui-core-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spence%2Fopentui-core-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spence%2Fopentui-core-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spence%2Fopentui-core-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spence%2Fopentui-core-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spence","download_url":"https://codeload.github.com/spence/opentui-core-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spence%2Fopentui-core-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33856288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-06-03T09:04:01.207Z","updated_at":"2026-06-03T09:04:02.217Z","avatar_url":"https://github.com/spence.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opentui-core\n\nRust bindings to the [sst/opentui](https://github.com/sst/opentui) terminal rendering engine. Direct access to the high-performance Zig core without a JavaScript/TypeScript runtime.\n\n![demo](demo.gif)\n\n## Features\n\n- **Double-buffered diff rendering** -- only changed cells produce ANSI output\n- **Real alpha blending** -- Porter-Duff compositing with f32 RGBA\n- **Scissor clipping** -- nested rectangular viewport masking\n- **Opacity stacking** -- hierarchical transparency layers\n- **Buffer compositing** -- draw one buffer onto another\n- **Text editing** -- rope-backed edit buffers with undo/redo, word navigation, and visual cursor\n- **Syntax styles** -- named style registry for highlighting\n- **Hyperlinks** -- OSC 8 link support\n- **Kitty keyboard protocol**\n- **Unicode/grapheme-aware** text handling\n\n## Requirements\n\n- Rust 1.70+\n- [Zig 0.15.2](https://ziglang.org/download/) (for building the core library)\n\n## Install\n\n```sh\ncargo add opentui-core --git https://github.com/spence/opentui-core-rs\n```\n\n## Quick start\n\n```rust\nuse opentui_core::{Renderer, Rgba};\n\nlet mut renderer = Renderer::new(80, 24).unwrap();\n\nlet buf = renderer.next_buffer();\nbuf.clear(\u0026Rgba::BLACK);\nbuf.draw_text(\"Hello, opentui!\", 0, 0, \u0026Rgba::WHITE, None, 0);\nbuf.fill_rect(0, 2, 40, 3, \u0026Rgba::from_hex(\"#1a1a2e\").unwrap());\ndrop(buf);\n\nrenderer.render(false);\n```\n\nThe renderer diffs back vs front buffers and emits only the ANSI sequences needed to update changed cells.\n\n## Architecture\n\n```\nYour app\n  │\n  ├─ renderer.next_buffer()  →  BufferRef\n  │       │\n  │       ├── clear(bg)\n  │       ├── draw_text(text, x, y, fg, bg, attrs)\n  │       ├── fill_rect(x, y, w, h, color)\n  │       ├── draw_box(...)\n  │       ├── push_scissor_rect / pop_scissor_rect\n  │       ├── push_opacity / pop_opacity\n  │       └── draw_frame_buffer (composite)\n  │\n  └─ drop(buf)  →  renderer.render(force)\n                      │\n                      ├── diff back vs front\n                      ├── ANSI output (changed cells only)\n                      └── swap buffers\n```\n\n`BufferRef` borrows the renderer mutably. Drop it before calling `render()`.\n\n## API overview\n\n### Drawing\n\n```rust\nbuf.clear(\u0026bg);\nbuf.draw_text(\"hello\", x, y, \u0026fg, Some(\u0026bg), 0);\nbuf.fill_rect(x, y, w, h, \u0026color);\nbuf.draw_box(x, y, w, h, \u0026border_chars, packed, \u0026border, \u0026bg, title, bottom);\nbuf.draw_char(ch, x, y, \u0026fg, \u0026bg, 0);\nbuf.set_cell_blended(x, y, ch, \u0026fg, \u0026bg, 0);  // alpha blend\nbuf.draw_frame_buffer(dx, dy, \u0026source, sx, sy, sw, sh);\n```\n\n### Scissor clipping\n\n```rust\nbuf.push_scissor_rect(10, 5, 30, 10);\nbuf.fill_rect(0, 0, 80, 24, \u0026red);  // clipped to 30x10 region\nbuf.pop_scissor_rect();\n```\n\n### Opacity\n\n```rust\nbuf.push_opacity(0.5);\nbuf.draw_text(\"faded\", 0, 0, \u0026white, None, 0);\nbuf.pop_opacity();\n```\n\n### Text editing\n\n```rust\nlet mut eb = EditBuffer::new(WidthMethod::Wcwidth).unwrap();\neb.set_text(\"fn main() {}\");\neb.set_cursor(0, 3);\neb.insert_text(\"hello\");\n\nlet mut view = EditorView::new(\u0026eb, 60, 20).unwrap();\nview.set_viewport(0, 0, 60, 20, false);\nview.set_wrap_mode(WrapMode::Word);\n\nbuf.draw_editor_view(\u0026mut view, 0, 0);\n```\n\n### Hyperlinks\n\n```rust\nlet link_id = link_alloc(\"https://example.com\");\nlet attrs = attributes_with_link(0, link_id);\nbuf.draw_text(\"click me\", x, y, \u0026fg, None, attrs);\n```\n\n## Examples\n\n```sh\ncargo run --example hello  # minimal render\ncargo run --example leto   # interactive trace viewer (shown in demo above)\n```\n\n## Claude Code plugin\n\nInstall the skill to let Claude build TUIs with this crate:\n\n```\n/plugin marketplace add spence/opentui-core-rs\n/plugin install opentui-core\n```\n\nThen use `/opentui-core:build-tui \u003cdescription\u003e`.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspence%2Fopentui-core-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspence%2Fopentui-core-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspence%2Fopentui-core-rs/lists"}