{"id":15011661,"url":"https://github.com/fcrozetta/tui-netcore","last_synced_at":"2025-04-12T03:31:11.478Z","repository":{"id":54522114,"uuid":"117694581","full_name":"fcrozetta/tui-netcore","owner":"fcrozetta","description":"Text User Interface for .net Core.","archived":false,"fork":false,"pushed_at":"2021-11-11T13:57:35.000Z","size":2116,"stargazers_count":36,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T23:24:02.470Z","etag":null,"topics":["csharp","dotnet-core","hacktoberfest","nuget-package","tui"],"latest_commit_sha":null,"homepage":"https://fcrozetta.github.io/tui-netcore/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fcrozetta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"ko_fi":"fcrozetta"}},"created_at":"2018-01-16T14:33:47.000Z","updated_at":"2024-11-16T19:52:46.000Z","dependencies_parsed_at":"2022-08-13T18:31:12.394Z","dependency_job_id":null,"html_url":"https://github.com/fcrozetta/tui-netcore","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcrozetta%2Ftui-netcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcrozetta%2Ftui-netcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcrozetta%2Ftui-netcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcrozetta%2Ftui-netcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcrozetta","download_url":"https://codeload.github.com/fcrozetta/tui-netcore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248512552,"owners_count":21116624,"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":["csharp","dotnet-core","hacktoberfest","nuget-package","tui"],"created_at":"2024-09-24T19:41:24.651Z","updated_at":"2025-04-12T03:31:08.749Z","avatar_url":"https://github.com/fcrozetta.png","language":"C#","funding_links":["https://ko-fi.com/fcrozetta"],"categories":[],"sub_categories":[],"readme":"\n![.NET Core](https://github.com/fcrozetta/tui-netcore/workflows/.NET%20Core/badge.svg)\n# tui-netcore\nSimple Text User Interface for .net Core.\nThis Class was implemented to make easy to implement a simple interface for the user.\nIt's is possible to use, but bugs are still happening.\n\n\u003e Nuget Package was released Firstly as Stable package. That was not the intention.\n\n\u003e0.0.1 and 0.0.1-alpha are the same.\n\n# Contents\n- [tui-netcore](#tui-netcore)\n- [Contents](#contents)\n- [But why?](#but-why)\n- [Instalation](#instalation)\n- [Usage](#usage)\n  - [Creating a Hello World](#creating-a-hello-world)\n  - [Instantiating the box object](#instantiating-the-box-object)\n  - [OK Box](#ok-box)\n  - [Drawing a box, without waiting response from user](#drawing-a-box-without-waiting-response-from-user)\n  - [Drawing an Input Box](#drawing-an-input-box)\n  - [Drawing a Yes/No Box](#drawing-a-yesno-box)\n  - [Draw a check Box](#draw-a-check-box)\n  - [Draw a list box](#draw-a-list-box)\n  - [Draw a Book box](#draw-a-book-box)\n- [Bugs](#bugs)\n\n# But why?\n\u003etl,dr; Because why not?\n\nI've used other TUI programs in python, bash and node, but personally i didn't enjoy all the parameters i had to pass to render a simple message in the screen. So, i created one class, that draws a box, and the same box can be rendered as:\n- Simple message box (pressing any key will continue)\n- User Input box (User can type the answer and press \u003ckbd\u003eenter\u003c/kbd\u003e to confirm)\n- Yes/No box (User can select with Arrow keys, and \u003ckbd\u003eenter\u003c/kbd\u003e to confirm)\n- Check Box (User can select multiple elements with arrow keys and \u003ckbd\u003espacebar\u003c/kbd\u003e, and \u003ckbd\u003eenter\u003c/kbd\u003e to confirm)\n- List Box (User can choose one option in the list, and press \u003ckbd\u003eenter\u003c/kbd\u003e to select the option)\n\n\n\n# Instalation\n\n\u003e If you don't have dotnet core installed, you can follow the instructions on this website : https://www.microsoft.com/net/download/windows\n\nIf you have your own project and want to use this interface, you just have to install the package. The easiest way to do it is:\n1. open a terminal and go to your project folder\n2. Execute command:\n    `dotnet add package fc.tui-core`\n3. Execute the command:\n    `dotnet restore`\n\n\u003e If you need other ways to install the package, you can check https://www.nuget.org/packages/fc.tui-core/\n\n# Usage\nTo use the class, it's possible to initialize only one time use the same windows multiple times. In this section we will initialize once and use it for every example.\n\n## Creating a Hello World\n\n![asciicast](imgs/screen-tui-netcore-hello-world.gif)\n\nThe easiest way to start is creating a window that uses all the available space in your terminal.\n\nIn your project, add the import\n```csharp\nusing tui_netcore;\n```\n\nand inside your program, create a new window:\n\n```csharp\nTui window = new Tui()\nwindow.Title = \" Hello World \";\nwindow.Body = \"This is a dullscreen window\";\nwindow.DrawOk();\n```\n\nand run it with ```dotnet run``` or the method you prefer.\n## Instantiating the box object\n\n```csharp\nusing tui_netcore;\n\n/* Inside your main */\nTui t= new Tui();\n```\n\nIf you want to use directly, you can also use the following code:\n```csharp\nusing tui_netcore;\n\n/* Inside your main */\nTui.ColorSchema schema =Tui.ColorSchema.Info; // This is used to change the color of the box\nTui t = new Tui(){\n    Title = \"Title message\",\n    Body = \"Body message\"\n};\n```\n\n## OK Box\n![drawOk](imgs/screen-tui-netcore-draw-ok-box.gif)\n\n```csharp\nt.DrawOk();\n```\nYes. It's simple like that.\n\nDrawOk() Method will accept any key to continue.\n\n\n\n## Drawing a box, without waiting response from user\n```csharp\n    t.Draw();\n```\nThis will create a box, and continue the program. Use this as a part of something more complex.\n\n## Drawing an Input Box\n![drawInput](imgs/screen-tui-netcore-draw-input.gif)\n\n```csharp\nstring answer = t.DrawInput();\n```\n\nThe return type of the DrawInput Method will always be a string.\nNote that the Property AnserChar will be printed where the User have to type\n\n## Drawing a Yes/No Box\n![drawYesNo](imgs/screen-tui-netcore-yes-no.gif)\n\n```csharp\nbool answer = t.DrawYesNo();\n```\n\nThe Yes/no box returns a bool, where \"yes\" is true.\n\n\nYou can customise the \"yes\" and \"no\" words, like this:\n```csharp\nbool answer = t.DrawYesNo(schema,txtYes=\"YAH\",txtNo=\"NAH\");\n```\nYou can also set the default option, adding an argument at the end of the method:\n```csharp\n// This set the default answer to YES (true)\nbool answer = t.DrawYesNo(schema,txtYes=\"YAH\",txtNo=\"NAH\",defaultAnswer=true);\n```\n## Draw a check Box\n[![asciicast](https://asciinema.org/a/CXProc6Etf4UuPR6s7aQKnutp.svg)](https://asciinema.org/a/CXProc6Etf4UuPR6s7aQKnutp)\nThis type of box will allow the user to select multiple options with spacebar, and continue with Enter\nThe signature of the method is:\n```csharp\npublic List\u003cCheckBoxOption\u003e DrawCheckBox(List\u003cCheckBoxOption\u003e options, ColorSchema schema = ColorSchema.Regular, bool onlyChecked = true)\n```\nThe first parameter is a list of checkboxOption objects, followed by a ColoSchema, and a boolean as last parameter.\nYou can check the CheckBox class on TUI.cs file.\nThe schema is also set on TUI.cs file, and is used to change the colors of the boxes.\nThe last parameter is used to return only the options selected by the user(true), or the entire list, with checked and unchecked values.\n\n\u003eNote that the return type is a list of CheckBoxOption\n\n## Draw a list box\n[![asciicast](https://asciinema.org/a/z3qETOmPLjxLabSp1hALvREbo.svg)](https://asciinema.org/a/z3qETOmPLjxLabSp1hALvREbo)\n![drawList](imgs/drawlist.png)\n\nThis type of box will render a List of otions where the user can select only one option. This box can be used as simple selction and menu.\n\n\u003eFor now there is no description. If you want to show the description, you have to format manually the strings.\n```csharp\nstring ListBox = t.DrawList(new List\u003cstring\u003e() {\n                \"Banana\",\n                \"Apple\",\n                \"Orange\"\n        });\n```\n## Draw a Book box\n[![asciicast](https://asciinema.org/a/uaBmZK6X3nS8tovaTUbDCrHi3.svg)](https://asciinema.org/a/uaBmZK6X3nS8tovaTUbDCrHi3)\n![drawBook](imgs/drawBook.png)\n\nThis type of box will render a \"book\" splitting the text into pages.\n\nThe page number will be at the title bar, after the title\n\n```csharp\nstring ListBox = t.DrawBook();\n```\n\n# Bugs\nYes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcrozetta%2Ftui-netcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcrozetta%2Ftui-netcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcrozetta%2Ftui-netcore/lists"}