{"id":28990504,"url":"https://github.com/raphgl/termcl","last_synced_at":"2025-06-25T00:11:47.707Z","repository":{"id":280511857,"uuid":"942214073","full_name":"RaphGL/TermCL","owner":"RaphGL","description":"Terminal Control Library for Odin","archived":false,"fork":false,"pushed_at":"2025-06-23T18:22:19.000Z","size":432,"stargazers_count":37,"open_issues_count":8,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-23T19:31:57.179Z","etag":null,"topics":["ansi-escape-codes","ansi-escape-sequences","cli","ncurses","terminal","tui"],"latest_commit_sha":null,"homepage":"","language":"Odin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RaphGL.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}},"created_at":"2025-03-03T18:54:59.000Z","updated_at":"2025-06-23T18:22:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"b84d5ca4-e7c2-449f-a572-3ad00be9dc6e","html_url":"https://github.com/RaphGL/TermCL","commit_stats":null,"previous_names":["raphgl/termcl"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/RaphGL/TermCL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaphGL%2FTermCL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaphGL%2FTermCL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaphGL%2FTermCL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaphGL%2FTermCL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RaphGL","download_url":"https://codeload.github.com/RaphGL/TermCL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaphGL%2FTermCL/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261777776,"owners_count":23208130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ansi-escape-codes","ansi-escape-sequences","cli","ncurses","terminal","tui"],"created_at":"2025-06-25T00:11:44.947Z","updated_at":"2025-06-25T00:11:47.659Z","avatar_url":"https://github.com/RaphGL.png","language":"Odin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003eTermCL\u003c/h1\u003e\n  \u003ch3 align=\"center\"\u003eTerminal control and ANSI escape code library for Odin\u003c/h3\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cbr /\u003e\n    \u003c!-- TODO: Add docs link later --\u003e\n    \u003c!-- \u003ca href=\"https://github.com/RaphGL/TermCL\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e --\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    ·\n    \u003ca href=\"https://github.com/RaphGL/TermCL/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/RaphGL/TermCL/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails open=\"open\"\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#how-it-works\"\u003eHow it works\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n\nTermCL is an Odin library for writing TUIs and CLIs with.\nThe library is compatible with any ANSI escape code compatible terminal, which is to say, almost every single modern terminal worth using :)\n\nThe library should also work on windows and any posix compatible operating system.\n\n## How it works\nThe library uses a Screen struct to represent the terminal. To start a CLI/TUI you need to call `init_screen`,\nthis function calls the operating system to get information on the terminal state.\n\n\u003e [!NOTE]\n\u003e you should call destroy_screen before you exit to restore the terminal state otherwise you might end up with a weird behaving terminal\n\nAfter that you should just set the terminal to whatever mode you want with the `set_term_mode` function, there are 3 modes you can use:\n- Raw mode (`.Raw`) - prevents the terminal from processing the user input so that you can handle them yourself\n- Cooked mode (`.Cbreak`) - prevents user input but unlike raw, it still processed for signals like Ctrl + C and others\n- Restored mode (`.Restored`) - restores the terminal to the state it was in before the program started messing with it, this is also called when the screen is destroyed\n\nAfter doing this, you should be good to go to do whatever you want.\n\nHere's a few minor things to take into consideration:\n- To handle input you can use the `read` function or the `read_blocking` function, as the default read is nonblocking.\n- There's convenience functions that allow you to more easily process input, they're called `parse_keyboard_input` and `parse_mouse_input`\n- Whatever you do won't show up on screen until you `blit`, since everything is cached first, windows also have their own cached escapes, so make sure you blit them as well\n\n## Usage\n\n```odin\npackage main\n\nimport \"termcl\"\n\nmain :: proc() {\n    scr := termcl.init_screen()\n    defer termcl.destroy_screen(\u0026scr)\n\n    termcl.set_text_style(\u0026scr, {.Bold, .Italic})\n    termcl.write(\u0026scr, \"Hello \")\n    termcl.reset_styles(\u0026scr)\n\n    termcl.set_text_style(\u0026scr, {.Dim})\n    termcl.set_color_style_8(\u0026scr, .Green, nil)\n    termcl.write(\u0026scr, \"from ANSI escapes\")\n    termcl.reset_styles(\u0026scr)\n\n    termcl.move_cursor(\u0026scr, 10, 10)\n    termcl.write(\u0026scr, \"Alles Ordnung\")\n\n    termcl.blit(\u0026scr)\n}\n```\n\nCheck the `examples` directory to see more on how to use it.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphgl%2Ftermcl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphgl%2Ftermcl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphgl%2Ftermcl/lists"}