{"id":20506359,"url":"https://github.com/delta456/box-cli-maker","last_synced_at":"2025-05-14T19:08:21.304Z","repository":{"id":44645373,"uuid":"260402101","full_name":"Delta456/box-cli-maker","owner":"Delta456","description":"Make Highly Customized Boxes for CLI","archived":false,"fork":false,"pushed_at":"2025-02-02T20:56:47.000Z","size":1153,"stargazers_count":561,"open_issues_count":7,"forks_count":23,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T13:24:58.618Z","etag":null,"topics":["bash","box","cli","collaborate","color","console","emoji","go","golang","shell","tabs","terminal","tui","unicode"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Delta456.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-05-01T07:23:56.000Z","updated_at":"2025-05-09T12:41:08.000Z","dependencies_parsed_at":"2024-01-08T14:30:52.213Z","dependency_job_id":"ec5508ff-efdd-4bae-9558-2c126d2667cc","html_url":"https://github.com/Delta456/box-cli-maker","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Delta456%2Fbox-cli-maker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Delta456%2Fbox-cli-maker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Delta456%2Fbox-cli-maker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Delta456%2Fbox-cli-maker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Delta456","download_url":"https://codeload.github.com/Delta456/box-cli-maker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"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":["bash","box","cli","collaborate","color","console","emoji","go","golang","shell","tabs","terminal","tui","unicode"],"created_at":"2024-11-15T19:56:27.367Z","updated_at":"2025-05-14T19:08:19.519Z","avatar_url":"https://github.com/Delta456.png","language":"Go","readme":"\u003chr/\u003e\r\n\u003cdiv align=\"center\"\u003e\r\n\u003cimg src=\"img/lib_logo.png\" alt=\"logo\"\u003e\r\n\u003c/div\u003e\r\n\u003chr/\u003e\r\n\u003cbr/\u003e\r\n\u003cdiv align=\"center\"\u003e\r\n\r\n[![Go Reference](https://pkg.go.dev/badge/github.com/Delta456/box-cli-maker/v2.svg)](https://pkg.go.dev/github.com/Delta456/box-cli-maker/v2)\r\n[![godocs.io](http://godocs.io/github.com/Delta456/box-cli-maker?status.svg)](https://godocs.io/github.com/Delta456/box-cli-maker/v2)\r\n[![CI](https://github.com/Delta456/box-cli-maker/workflows/Box%20CLI%20Maker/badge.svg)](https://github.com/Delta456/box-cli-maker/actions?query=workflow%3A\"Box+CLI+Maker\")\r\n[![Go Report Card](https://goreportcard.com/badge/github.com/Delta456/box-cli-maker)](https://goreportcard.com/report/github.com/Delta456/box-cli-maker)\r\n[![GolangCI](https://golangci.com/badges/github.com/moul/golang-repo-template.svg)](https://golangci.com/r/github.com/Delta456/box-cli-maker)\r\n[![GitHub release](https://img.shields.io/github/release/Delta456/box-cli-maker.svg)](https://github.com/Delta456/box-cli-maker/releases)\r\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\r\n\r\n\u003c/div\u003e\r\n\r\n## Features\r\n\r\n- Make a Terminal Box in 8️⃣ inbuilt different styles\r\n- 16 Inbuilt Colors and True Color Support 🎨\r\n- Custom Title Positions 📏\r\n- Make your Terminal Box style 📦\r\n- Support for ANSI, Tabbed, Multi-line and Line Wrapping boxes 📑\r\n- Align the text according to your needs 📐\r\n- Unicode, Emoji and [Windows Console](https://en.wikipedia.org/wiki/Windows_Console) Support 😋\r\n- Written in 🇬 🇴\r\n\r\n## Installation\r\n\r\n```terminal\r\n go get github.com/Delta456/box-cli-maker/v2\r\n```\r\n\r\n## Usage Tutorial\r\n\r\nIn `main.go`\r\n\r\n```go\r\npackage main\r\n\r\nimport \"github.com/Delta456/box-cli-maker/v2\"\r\n\r\nfunc main() {\r\n Box := box.New(box.Config{Px: 2, Py: 5, Type: \"Single\", Color: \"Cyan\"})\r\n Box.Print(\"Box CLI Maker\", \"Highly Customized Terminal Box Maker\")\r\n}\r\n```\r\n\r\n`box.New(config Config)` takes Box `Config` and returns a `Box` from the given `Config`.\r\n\r\n- Parameters\r\n  - `Px` : Horizontal Padding\r\n  - `Py` : Vertical Padding\r\n  - `ContentAlign` : Content Alignment inside Box i.e. `Center`, `Left` and `Right`\r\n  - `Type`: Box Type\r\n  - `TitlePos` : Title Position of Box i.e. `Inside`, `Top` and `Bottom`\r\n  - `Color` : Box Color\r\n  - `TitleColor` : Title Color\r\n  - `ContentColor` : Content Color\r\n  - `AllowWrapping`: Flag to allow custom `Content` wrapping\r\n  - `WrappingLimit`: Wrap the `Content` up to the Limit\r\n\r\n### `Box` Methods\r\n\r\n`Box.Print(title, lines string)` prints Box from the specified arguments.\r\n\r\n- Parameters\r\n  - `title` : Box Title\r\n  - `lines` : Box Content\r\n\r\n`Box.Println(title, lines string)` prints Box in a newline from the specified arguments.\r\n\r\n- Parameters\r\n  - `title` : Box Title\r\n  - `lines` : Box Content\r\n\r\n`Box.String(title, lines string) string` returns `string` representation of Box.\r\n\r\n- Parameters\r\n  - `title` : Box Title\r\n  - `lines` : Box Content\r\n\r\n### Box Types\r\n\r\n- `Single`\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/single.svg\" alt=\"single\" width=500/\u003e\r\n\u003c/p\u003e\r\n\r\n- `Single Double`\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/single_double.svg\" alt=\"single_double\" width=\"500\"/\u003e\r\n\u003c/p\u003e\r\n\r\n- `Double`\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/double.svg\" alt=\"double\" width=\"500\"/\u003e\r\n\u003c/p\u003e\r\n\r\n- `Double Single`\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/double_single.svg\" alt=\"double_single\" width=\"500\"/\u003e\r\n\u003c/p\u003e\r\n\r\n- `Bold`\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/bold.svg\" alt=\"bold\" width=\"500\"/\u003e\r\n\u003c/p\u003e\r\n\r\n- `Round`\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/round.svg\" alt=\"round\" width=\"500\"/\u003e\r\n\u003c/p\u003e\r\n\r\n- `Hidden`\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/hidden.svg\" alt=\"hidden\" width=\"500\"/\u003e\r\n\u003c/p\u003e\r\n\r\n- `Classic`\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/classic.svg\" alt=\"classic\" width=\"500\"/\u003e\r\n\u003c/p\u003e\r\n\r\n### Title Positions\r\n\r\n- `Inside`\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/single.svg\" alt=\"single\" width=500/\u003e\r\n\u003c/p\u003e\r\n\r\n- `Top`\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/top.svg\" alt=\"top\" width=500/\u003e\r\n\u003c/p\u003e\r\n\r\n- `Bottom`\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/bottom.svg\" alt=\"bottom\" width=500/\u003e\r\n\u003c/p\u003e\r\n\r\n### Custom Box\r\n\r\nA Custom Box can be created by using the built-in Box struct provided by the module.\r\n\r\n```go\r\ntype Box struct {\r\n  TopRight    string // TopRight Corner Symbols\r\n  TopLeft     string // TopLeft Corner Symbols\r\n  Vertical    string // Vertical Bar Symbols\r\n  BottomRight string // BottomRight Corner Symbols\r\n  BottomLeft  string // BottomLeft Corner Symbols\r\n  Horizontal  string // Horizontal Bar Symbols\r\n  Config             // Box Config\r\n}\r\n```\r\n\r\n#### Usage\r\n\r\nIn `main.go`:\r\n\r\n```go\r\npackage main\r\n\r\nimport \"github.com/Delta456/box-cli-maker/v2\"\r\n\r\nfunc main() {\r\n    config := box.Config{Px: 2, Py: 3, Type: \"\", TitlePos: \"Inside\"}\r\n    boxNew := box.Box{TopRight: \"*\", TopLeft: \"*\", BottomRight: \"*\", BottomLeft: \"*\", Horizontal: \"-\", Vertical: \"|\", Config: config}\r\n    boxNew.Println(\"Box CLI Maker\", \"Make Highly Customized Terminal Boxes\")\r\n}\r\n```\r\n\r\n\u003cp align=\"center\" style=\"margin-top: 30px; margin-bottom: 20px;\"\u003e\r\n\u003cimg src=\"img/custom.svg\" alt=\"custom\" width=500/\u003e\r\n\u003c/p\u003e\r\n\r\nMore examples can be found in the `examples/` folder which you can explore yourself.\r\nFeel free to add more examples and submit a pr for the same.\r\n\r\n### Color Types\r\n\r\n The [gookit/color](https://github.com/gookit/color) module provides support for colors in your program. It uses two main types: `FgColor` and `FgHiColor`. These types correspond to different color settings.`Color` is a key for the following maps:\r\n\r\n```go\r\n fgColors map[string]color.Color = {\r\n  \"Black\":   color.FgBlack,\r\n  \"Blue\":    color.FgBlue,\r\n  \"Red\":     color.FgRed,\r\n  \"Green\":   color.FgGreen,\r\n  \"Yellow\":  color.FgYellow,\r\n  \"Cyan\":    color.FgCyan,\r\n  \"Magenta\": color.FgMagenta,\r\n  \"White\":   color.FgWhite,\r\n}\r\n\r\n fgHiColors map[string]color.Color = {\r\n  \"HiBlack\":   color.FgDarkGray,\r\n  \"HiBlue\":    color.FgLightBlue,\r\n  \"HiRed\":     color.FgLightRed,\r\n  \"HiGreen\":   color.FgLightGreen,\r\n  \"HiYellow\":  color.FgLightYellow,\r\n  \"HiCyan\":    color.FgLightCyan,\r\n  \"HiMagenta\": color.FgLightMagenta,\r\n  \"HiWhite\":   color.FgLightWhite,\r\n}\r\n```\r\n\r\nThere are two maps, `fgColors` and `fgHiColors`, which map color names to their respective settings. Here are some examples:\r\n\r\n- `fgColors` maps basic colors like Black, Blue, Red, Green, Yellow, Cyan, Magenta, and White.\r\n- `fgHiColors` maps high-intensity colors like HiBlack, HiBlue, HiRed, HiGreen, HiYellow, HiCyan, HiMagenta, and HiWhite.\r\n\r\nIf you want to use high-intensity colors, make sure the color name starts with \"Hi.\" If the color option is empty or invalid, no color will be applied.\r\n\r\nYou can also use True Colors by providing them as either a `uint` or `[3]uint`. For `[3]uint`, all elements must be in the range of `[0, 0xFF]`, and for `uint`, it should be in the range of `[0x000000, 0xFFFFFF]`.\r\n\r\nIf your terminal doesn't support True Colors, the module will automatically round the colors to match the terminal's maximum supported colors. This simplifies things for most users.\r\n\r\nIf you're curious about supported terminals, you can check the list of 24-bit [supported terminals](https://gist.github.com/XVilka/8346728) and 8-bit [supported terminals](https://fedoraproject.org/wiki/Features/256_Color_Terminals).\r\n\r\nAdditionally, this module enables True Color and 256 Colors support on Windows Console through [Virtual Terminal Processing](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences). However, for 256 colors, you need at least [Windows 10 Version 1511](https://en.wikipedia.org/wiki/Windows_10_version_history_(version_1511)), and for True Color support, you need at least [Windows 10 Version 1607](https://en.wikipedia.org/wiki/Windows_10_version_history_(version_1607)).\r\n\r\nFinally, if you're using Windows, the module can detect `ConEmu` or `ANSICON` if they're installed. To ensure the best experience, it's recommended to use the latest versions of both programs.\r\n\r\n### Content Wrapping\r\n\r\nThis library allows the usage of custom wrapping of `Content` so that the Box formed will be created according to your own needs.\r\n\r\nTo use this feature, you need to do two things:\r\n\r\n1. Set Config.AllowWrapping to true. This tells the library to allow custom wrapping.\r\n\r\n2. Optionally, you can set your own wrapping limit using Config.WrappingLimit. By default, the wrapping limit is set to 2/3 of the current terminal's width (TermWidth).\r\n\r\nSo, in simple terms, if you want to customize how content is wrapped in boxes, make sure to enable wrapping with Config.AllowWrapping, and if needed, you can adjust the wrapping limit using Config.WrappingLimit, which is initially set to 2/3 of the terminal's width.\r\n\r\n### Note\r\n\r\n#### 1. Vertical Alignment\r\n\r\nAs different terminals have different fonts by default, the right vertical alignment may not be aligned well. You will have to change your font accordingly to make it work.\r\n\r\n#### 2. Limitations of Unicode and Emoji\r\n\r\nUnicode is a character encoding standard that assigns unique codes to characters from various writing systems, allowing universal text representation. \r\n\r\nThis library relies on [mattn/go-runewidth](https://github.com/mattn/go-runewidth) to support Unicode and Emoji characters but consider the following:\r\n\r\n1. Proper rendering of Unicode and Emojis on Windows is primarily supported by `Windows Terminal`, `ConEmu`, and `Mintty` as terminal emulators. They handle these characters well.\r\n\r\n2. Indic text (a script used in some Indian languages) may not display correctly in most terminals. It's important to note that support for Indic text is quite limited.\r\n\r\n3. Avoid using this library in certain environments like online code playgrounds such as [`Go Playground`](https://play.golang.org/), [`Repl.it`](https://repl.it), and in Continuous Integration/Continuous Deployment (CI/CD) pipelines. These platforms typically use fonts that only support basic ASCII characters, making it problematic to accurately calculate character lengths when the font changes dynamically.\r\n\r\n4. Depending on your font settings, you may need to make adjustments to ensure proper rendering of Unicode and Emoji characters. Failure to do so could result in issues with vertical alignment.\r\n\r\nIn essence, while this library supports Unicode and Emojis, there are limitations and considerations to keep in mind, especially when dealing with different terminal environments and character sets.\r\n\r\n#### 3. Terminal Color Detection\r\n\r\nFor beginners, this library can adjust True Color to work with your terminal's capabilities, either 8-bit or 4-bit color.\r\n\r\nDetecting your terminal's color capacity isn't always straightforward, and there's no universal method. However, if you know a solution for your specific terminal, you can contribute by making a pull request.\r\n\r\nFor Unix systems:\r\n\r\n- If True Color detection fails, you can set the `COLORTERM` environment variable to `truecolor` or `24bit` for True Color support.\r\n\r\n- For 8-bit color-based terminals, if detection doesn't work, set the `TERM` environment variable to your terminal emulator's name followed by `256color`, like `xterm-256color`.\r\n\r\nKeep in mind that very old terminals like [`Windows Console (Legacy Mode)`](https://docs.microsoft.com/en-us/windows/console/legacymode) or terminals with `TERM` set to `DUMB` might not show color effects, and the module may output unexpected results or warnings.\r\n\r\nIt's generally not recommended to use this library with color effects in Online Playgrounds, CI/CD environments, Browsers, and similar platforms since color support varies, and detection is challenging. If you encounter issues, you can open an issue and suggest a solution!\r\n\r\n#### 4. Tabs\r\n\r\nThis library supports the usage of tabs but their use should be limited.\r\n\r\n### Projects using Box CLI Maker\r\n\r\n- \u003cimg src=\"img\\k8s_logo.png\" alt=\"kubernetes logo\" width=\"20\"\u003e [kubernetes/minikube](https://github.com/kubernetes/minikube): Run Kubernetes locally.\r\n- +[Many More](https://pkg.go.dev/github.com/Delta456/box-cli-maker/v2?tab=importedby)!\r\n\r\n### Acknowledgements\r\n\r\nI thank the following people and their packages whom I have studied and was able to port to Go accordingly.\r\n\r\n- [thecodrr/boxx](https://github.com/thecodrr/boxx)\r\n- [Atrox/box](https://github.com/Atrox/box)\r\n- [sindreorhus-cli-boxes](https://github.com/sindresorhus/cli-boxes)\r\n\r\nAlso special thanks to [@elimsteve](https://github.com/elimisteve) who helped me to optimize the code and told me the best possible ways to fix my problems, [@JalonSolov](https://github.com/JalonSolov) for tab lines support and [Kunal Raghav](https://github.com/KunalRaghav) for making the library's logo.\r\n\r\nKudos to [moul/golang-repo-template](https://github.com/moul/golang-repo-template) for their Go template.\r\n\r\n### License\r\n\r\nLicensed under [MIT](LICENSE)\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelta456%2Fbox-cli-maker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdelta456%2Fbox-cli-maker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelta456%2Fbox-cli-maker/lists"}