{"id":14263202,"url":"https://github.com/mgutz/ansi","last_synced_at":"2025-08-13T09:32:35.864Z","repository":{"id":8428906,"uuid":"10017208","full_name":"mgutz/ansi","owner":"mgutz","description":"Small, fast library to create ANSI colored strings and codes. [go, golang]","archived":false,"fork":false,"pushed_at":"2024-04-15T23:23:11.000Z","size":19,"stargazers_count":418,"open_issues_count":7,"forks_count":40,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-13T17:16:21.296Z","etag":null,"topics":["ansi-colors","go","terminal"],"latest_commit_sha":null,"homepage":null,"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/mgutz.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}},"created_at":"2013-05-12T17:53:32.000Z","updated_at":"2024-12-05T07:11:34.000Z","dependencies_parsed_at":"2024-08-22T13:13:14.972Z","dependency_job_id":"c4a6ffab-c8ef-4d13-9994-8eac30ccd1da","html_url":"https://github.com/mgutz/ansi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgutz%2Fansi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgutz%2Fansi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgutz%2Fansi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgutz%2Fansi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgutz","download_url":"https://codeload.github.com/mgutz/ansi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229754508,"owners_count":18119127,"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-colors","go","terminal"],"created_at":"2024-08-22T13:03:09.423Z","updated_at":"2024-12-14T20:30:39.645Z","avatar_url":"https://github.com/mgutz.png","language":"Go","funding_links":[],"categories":["Go","terminal"],"sub_categories":[],"readme":"# ansi\n\nPackage ansi is a small, fast library to create ANSI colored strings and codes.\n\n## Install\n\nGet it\n\n```sh\ngo get -u github.com/mgutz/ansi\n```\n\n## Example\n\n```go\nimport \"github.com/mgutz/ansi\"\n\n// colorize a string, SLOW\nmsg := ansi.Color(\"foo\", \"red+b:white\")\n\n// create a FAST closure function to avoid computation of ANSI code\nphosphorize := ansi.ColorFunc(\"green+h:black\")\nmsg = phosphorize(\"Bring back the 80s!\")\nmsg2 := phospohorize(\"Look, I'm a CRT!\")\n\n// cache escape codes and build strings manually\nlime := ansi.ColorCode(\"green+h:black\")\nreset := ansi.ColorCode(\"reset\")\n\nfmt.Println(lime, \"Bring back the 80s!\", reset)\n```\n\nOther examples\n\n```go\nColor(s, \"red\")            // red\nColor(s, \"red+d\")          // red dim\nColor(s, \"red+b\")          // red bold\nColor(s, \"red+B\")          // red blinking\nColor(s, \"red+u\")          // red underline\nColor(s, \"red+bh\")         // red bold bright\nColor(s, \"red:white\")      // red on white\nColor(s, \"red+b:white+h\")  // red bold on white bright\nColor(s, \"red+B:white+h\")  // red blink on white bright\nColor(s, \"off\")            // turn off ansi codes\n```\n\nTo view color combinations, from project directory in terminal.\n\n```sh\ngo test\n```\n\n## Style format\n\n```go\n\"foregroundColor+attributes:backgroundColor+attributes\"\n```\n\nColors\n\n* black\n* red\n* green\n* yellow\n* blue\n* magenta\n* cyan\n* white\n* 0...255 (256 colors)\n\nForeground Attributes\n\n* B = Blink\n* b = bold\n* h = high intensity (bright)\n* d = dim\n* i = inverse\n* s = strikethrough\n* u = underline\n\nBackground Attributes\n\n* h = high intensity (bright)\n\n## Constants\n\n* ansi.Reset\n* ansi.DefaultBG\n* ansi.DefaultFG\n* ansi.Black\n* ansi.Red\n* ansi.Green\n* ansi.Yellow\n* ansi.Blue\n* ansi.Magenta\n* ansi.Cyan\n* ansi.White\n* ansi.LightBlack\n* ansi.LightRed\n* ansi.LightGreen\n* ansi.LightYellow\n* ansi.LightBlue\n* ansi.LightMagenta\n* ansi.LightCyan\n* ansi.LightWhite\n\n## References\n\nWikipedia ANSI escape codes [Colors](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors)\n\nGeneral [tips and formatting](http://misc.flogisoft.com/bash/tip_colors_and_formatting)\n\nWhat about support on Windows? Use [colorable by mattn](https://github.com/mattn/go-colorable).\nAnsi and colorable are used by [logxi](https://github.com/mgutz/logxi) to support logging in\ncolor on Windows.\n\n## MIT License\n\nCopyright (c) 2013 Mario Gutierrez mario@mgutz.com\n\nSee the file LICENSE for copying permission.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgutz%2Fansi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgutz%2Fansi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgutz%2Fansi/lists"}