{"id":13413483,"url":"https://github.com/dimiro1/banner","last_synced_at":"2026-01-29T10:30:44.634Z","repository":{"id":41142940,"uuid":"54748533","full_name":"dimiro1/banner","owner":"dimiro1","description":"An easy way to add useful startup banners into your Go applications","archived":false,"fork":false,"pushed_at":"2021-01-04T09:25:38.000Z","size":745,"stargazers_count":447,"open_issues_count":0,"forks_count":24,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-07-31T20:52:23.119Z","etag":null,"topics":[],"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/dimiro1.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}},"created_at":"2016-03-25T21:28:44.000Z","updated_at":"2024-07-23T12:25:30.000Z","dependencies_parsed_at":"2022-09-09T20:02:31.766Z","dependency_job_id":null,"html_url":"https://github.com/dimiro1/banner","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimiro1%2Fbanner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimiro1%2Fbanner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimiro1%2Fbanner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimiro1%2Fbanner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimiro1","download_url":"https://codeload.github.com/dimiro1/banner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243635463,"owners_count":20322944,"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":[],"created_at":"2024-07-30T20:01:41.390Z","updated_at":"2026-01-29T10:30:44.605Z","avatar_url":"https://github.com/dimiro1.png","language":"Go","readme":"[![Build Status](https://travis-ci.org/dimiro1/banner.svg?branch=master)](https://travis-ci.org/dimiro1/banner)\n[![Go Report Card](https://goreportcard.com/badge/github.com/dimiro1/banner)](https://goreportcard.com/report/github.com/dimiro1/banner)\n[![GoDoc](https://godoc.org/github.com/dimiro1/banner?status.svg)](https://godoc.org/github.com/dimiro1/banner)\n\nTry browsing [the code on Sourcegraph](https://sourcegraph.com/github.com/dimiro1/banner)!\n\n# Banner\n\nAdd beautiful banners into your Go applications\n\n**Table of Contents**\n\n- [Motivation](#motivation)\n- [Usage](#usage)\n- [API](#api)\n- [Command line flags](#command-line-flags)\n- [Template](#template)\n- [Log](#log)\n- [ASCII Banners](#ascii-banners)\n- [LICENSE](#license)\n\n# Motivation\n\nI Like to add these startup banners on all my applications, I think it give personality to the application.\n\n# Usage\n\nImport the package. Thats it.\n\n```go\npackage main\n\nimport _ \"github.com/dimiro1/banner/autoload\"\n\nfunc main() {}\n```\n\nBy default it look at the file **banner.txt** in the same directory. You can customize with the command line flags.\n\nIf you do not want to use the autoload package you can always fallback to the banner API\n\n```go\npackage main\n\nimport (\n\t\"bytes\"\n\t\"os\"\n\n\t\"github.com/dimiro1/banner\"\n)\n\nfunc main() {\n  isEnabled := true\n  isColorEnabled := true\n  banner.Init(os.Stdout, isEnabled, isColorEnabled, bytes.NewBufferString(\"My Custom Banner\"))\n}\n```\n\nIf using windows, use go-colorable. This works in all-platforms.\n\n```go\npackage main\n\nimport (\n\t\"bytes\"\n\t\"os\"\n\n\t\"github.com/dimiro1/banner\"\n\t\"github.com/mattn/go-colorable\"\n)\n\nfunc main() {\n  isEnabled := true\n  isColorEnabled := true\n  banner.Init(colorable.NewColorableStdout(), isEnabled, isColorEnabled, bytes.NewBufferString(\"My Custom Banner\"))\n}\n```\n\n# API\n\nI recommend you to vendor this dependency in your project, as it is a good practice.\n\n# Command line flags\n\n```sh\n$ go run main.go -h\n```\n\nshould output\n\n```\nUsage of main:\n  -ansi\n    \tansi colors enabled? (default true)\n  -banner string\n    \tbanner.txt file (default \"banner.txt\")\n  -show-banner\n    \tprint the banner? (default true)\n```\n\n# Template\n\nYou can use the following variables in the template.\n\n| Variable                                     | Value                                     |\n| -------------------------------------------- | ----------------------------------------- |\n| `{{ .Title \"YourTitle\" \"fontname\" indent }}` | `\u003cGenerated ASCII art\u003e`                   |\n| `{{ .GoVersion }}`                           | `runtime.Version()`                       |\n| `{{ .GOOS }}`                                | `runtime.GOOS`                            |\n| `{{ .GOARCH }}`                              | `runtime.GOARCH`                          |\n| `{{ .NumCPU }}`                              | `runtime.NumCPU()`                        |\n| `{{ .GOPATH }}`                              | `os.Getenv(\"GOPATH\")`                     |\n| `{{ .GOROOT }}`                              | `runtime.GOROOT()`                        |\n| `{{ .Compiler }}`                            | `runtime.Compiler`                        |\n| `{{ .Env \"GOPATH\" }}`                        | `os.Getenv(\"GOPATH\")`                     |\n| `{{ .Now \"Monday, 2 Jan 2006\" }}`            | `time.Now().Format(\"Monday, 2 Jan 2006\")` |\n\nPlease see the layout of the function **.Now** in https://github.com/golang/go/blob/f06795d9b742cf3292a0f254646c23603fc6419b/src/time/format.go#L9-L41\n\n## Title\n\nTitle generates ascii art for you using [go-figure](https://github.com/common-nighthawk/go-figure)\nUse it if you don't provide your own ascii title.\n\nSee [examples/title](./examples/title) for an example\n\n**Note:** Must provide zero values if not using something i.e.\n\n```go\n// .Title string   string    int\n// .Title title    fontname  indentation_spaces\n{{ .Title \"Banner\" \"\"        0 }}\n{{ .Title \"Banner\" \"banner2\" 0 }}\n{{ .Title \"Banner\" \"\"        4 }}\n```\n\nThe fonts available can be seen here [go-figure#supported-fonts](https://github.com/common-nighthawk/go-figure#supported-fonts)\n\n## Colors\n\nThere are support for ANSI colors :)\n\n| Variable                              |\n| ------------------------------------- |\n| `{{ .AnsiColor.Default }}`            |\n| `{{ .AnsiColor.Black }}`              |\n| `{{ .AnsiColor.Red }}`                |\n| `{{ .AnsiColor.Green }}`              |\n| `{{ .AnsiColor.Yellow }}`             |\n| `{{ .AnsiColor.Blue }}`               |\n| `{{ .AnsiColor.Magenta }}`            |\n| `{{ .AnsiColor.Cyan }}`               |\n| `{{ .AnsiColor.White }}`              |\n| `{{ .AnsiColor.BrightBlack }}`        |\n| `{{ .AnsiColor.BrightRed }}`          |\n| `{{ .AnsiColor.BrightGreen }}`        |\n| `{{ .AnsiColor.BrightYellow }}`       |\n| `{{ .AnsiColor.BrightBlue }}`         |\n| `{{ .AnsiColor.BrightMagenta }}`      |\n| `{{ .AnsiColor.BrightCyan }}`         |\n| `{{ .AnsiColor.BrightWhite }}`        |\n| `{{ .AnsiBackground.Default }}`       |\n| `{{ .AnsiBackground.Black }}`         |\n| `{{ .AnsiBackground.Red }}`           |\n| `{{ .AnsiBackground.Green }}`         |\n| `{{ .AnsiBackground.Yellow }}`        |\n| `{{ .AnsiBackground.Blue }}`          |\n| `{{ .AnsiBackground.Magenta }}`       |\n| `{{ .AnsiBackground.Cyan }}`          |\n| `{{ .AnsiBackground.White }}`         |\n| `{{ .AnsiBackground.BrightBlack }}`   |\n| `{{ .AnsiBackground.BrightRed }}`     |\n| `{{ .AnsiBackground.BrightGreen }}`   |\n| `{{ .AnsiBackground.BrightYellow }}`  |\n| `{{ .AnsiBackground.BrightBlue }}`    |\n| `{{ .AnsiBackground.BrightMagenta }}` |\n| `{{ .AnsiBackground.BrightCyan }}`    |\n| `{{ .AnsiBackground.BrightWhite }}`   |\n\nWant to see a nyancat?\n\n```sh\n$ go run examples/file/main.go -banner examples/file/nyancat.txt\n```\n\n![NyanCat Banner](banner-nyan.png?raw=true \"NyanCat Banner\")\n\n## Example\n\n```\n  ____\n |  _ \\\n | |_) | __ _ _ __  _ __   ___ _ __\n |  _ \u003c / _` | '_ \\| '_ \\ / _ \\ '__|\n | |_) | (_| | | | | | | |  __/ |\n |____/ \\__,_|_| |_|_| |_|\\___|_|\n\nGoVersion: {{ .GoVersion }}\nGOOS: {{ .GOOS }}\nGOARCH: {{ .GOARCH }}\nNumCPU: {{ .NumCPU }}\nGOPATH: {{ .GOPATH }}\nGOROOT: {{ .GOROOT }}\nCompiler: {{ .Compiler }}\nENV: {{ .Env \"GOPATH\" }}\nNow: {{ .Now \"Monday, 2 Jan 2006\" }}\n```\n\nwill output something like this\n\n```\n  ____\n |  _ \\\n | |_) | __ _ _ __  _ __   ___ _ __\n |  _ \u003c / _` | '_ \\| '_ \\ / _ \\ '__|\n | |_) | (_| | | | | | | |  __/ |\n |____/ \\__,_|_| |_|_| |_|\\___|_|\n\nGoVersion: go1.6\nGOOS: darwin\nGOARCH: amd64\nNumCPU: 4\nGOPATH: /Users/claudemiro/go\nGOROOT: /usr/local/Cellar/go/1.6/libexec\nCompiler: gc\nENV: /Users/claudemiro/go\nNow: Friday, 26 Mar 2016\n```\n\n# Log\n\nI am using the standard golang log, but there is a function SetLog that accepts a custom log, so you can customize the way you want.\n\n# ASCII Banners\n\nAccess http://patorjk.com/software/taag/#p=display\u0026f=Big\u0026t=Banner to generate ASCII banners.\n\nOr use `{{ .Title }}` template\n\n# LICENSE\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 Claudemiro\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":["Miscellaneous","Go","Uncategorized","雜項","其他杂项","杂项","其他","Microsoft Office","\u003cspan id=\"其他-miscellaneous\"\u003e其他 Miscellaneous\u003c/span\u003e"],"sub_categories":["Strings","高級控制台界面","Uncategorized","暂未分类","未分类的","Advanced Console UIs","高级控制台界面","交流","暂未分类这些库被放在这里是因为其他类别似乎都不适合。","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimiro1%2Fbanner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimiro1%2Fbanner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimiro1%2Fbanner/lists"}