{"id":21595209,"url":"https://github.com/euank/color","last_synced_at":"2025-09-06T04:38:42.479Z","repository":{"id":57502275,"uuid":"225485651","full_name":"euank/color","owner":"euank","description":"A fork of https://github.com/fatih/color","archived":false,"fork":false,"pushed_at":"2025-07-23T08:56:15.000Z","size":1155,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T19:43:02.503Z","etag":null,"topics":[],"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/euank.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-02T23:03:33.000Z","updated_at":"2025-07-23T08:56:18.000Z","dependencies_parsed_at":"2024-06-20T05:41:47.540Z","dependency_job_id":"651be6cd-b852-4a9d-b0bf-5cdbbabdf497","html_url":"https://github.com/euank/color","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/euank/color","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2Fcolor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2Fcolor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2Fcolor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2Fcolor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/euank","download_url":"https://codeload.github.com/euank/color/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2Fcolor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273858848,"owners_count":25180766,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-24T17:34:13.242Z","updated_at":"2025-09-06T04:38:42.448Z","avatar_url":"https://github.com/euank.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Forked from [fatih/color](https://github.com/fatih/color)\n\nThe original [fatih/color](https://github.com/fatih/color) repository is archived. This is a fork of it in order to fix a small bug and switch it over to go mod.\n\nThis is not a \"github fork\" because code search, and other features, do not\nwork on github-fork-button-forks, so rather this is a fork as a standalone\nrepository.\n\n# Color [![GoDoc](https://godoc.org/github.com/euank/color?status.svg)](https://godoc.org/github.com/euank/color) [![Build Status](https://img.shields.io/travis/euank/color.svg?style=flat-square)](https://travis-ci.org/euank/color)\n\nColor lets you use colorized outputs in terms of [ANSI Escape\nCodes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It\nhas support for Windows too! The API can be used in several ways, pick one that\nsuits you.\n\n\n![Color](https://i.imgur.com/c1JI0lA.png)\n\n\n## Install\n\n```bash\ngo get github.com/euank/color\n```\n\nNote that the `vendor` folder is here for stability. Remove the folder if you\nalready have the dependencies in your GOPATH.\n\n## Examples\n\n### Standard colors\n\n```go\n// Print with default helper functions\ncolor.Cyan(\"Prints text in cyan.\")\n\n// A newline will be appended automatically\ncolor.Blue(\"Prints %s in blue.\", \"text\")\n\n// These are using the default foreground colors\ncolor.Red(\"We have red\")\ncolor.Magenta(\"And many others ..\")\n\n```\n\n### Mix and reuse colors\n\n```go\n// Create a new color object\nc := color.New(color.FgCyan).Add(color.Underline)\nc.Println(\"Prints cyan text with an underline.\")\n\n// Or just add them to New()\nd := color.New(color.FgCyan, color.Bold)\nd.Printf(\"This prints bold cyan %s\\n\", \"too!.\")\n\n// Mix up foreground and background colors, create new mixes!\nred := color.New(color.FgRed)\n\nboldRed := red.Add(color.Bold)\nboldRed.Println(\"This will print text in bold red.\")\n\nwhiteBackground := red.Add(color.BgWhite)\nwhiteBackground.Println(\"Red text with white background.\")\n```\n\n### Use your own output (io.Writer)\n\n```go\n// Use your own io.Writer output\ncolor.New(color.FgBlue).Fprintln(myWriter, \"blue color!\")\n\nblue := color.New(color.FgBlue)\nblue.Fprint(writer, \"This will print text in blue.\")\n```\n\n### Custom print functions (PrintFunc)\n\n```go\n// Create a custom print function for convenience\nred := color.New(color.FgRed).PrintfFunc()\nred(\"Warning\")\nred(\"Error: %s\", err)\n\n// Mix up multiple attributes\nnotice := color.New(color.Bold, color.FgGreen).PrintlnFunc()\nnotice(\"Don't forget this...\")\n```\n\n### Custom fprint functions (FprintFunc)\n\n```go\nblue := color.New(FgBlue).FprintfFunc()\nblue(myWriter, \"important notice: %s\", stars)\n\n// Mix up with multiple attributes\nsuccess := color.New(color.Bold, color.FgGreen).FprintlnFunc()\nsuccess(myWriter, \"Don't forget this...\")\n```\n\n### Insert into noncolor strings (SprintFunc)\n\n```go\n// Create SprintXxx functions to mix strings with other non-colorized strings:\nyellow := color.New(color.FgYellow).SprintFunc()\nred := color.New(color.FgRed).SprintFunc()\nfmt.Printf(\"This is a %s and this is %s.\\n\", yellow(\"warning\"), red(\"error\"))\n\ninfo := color.New(color.FgWhite, color.BgGreen).SprintFunc()\nfmt.Printf(\"This %s rocks!\\n\", info(\"package\"))\n\n// Use helper functions\nfmt.Println(\"This\", color.RedString(\"warning\"), \"should be not neglected.\")\nfmt.Printf(\"%v %v\\n\", color.GreenString(\"Info:\"), \"an important message.\")\n\n// Windows supported too! Just don't forget to change the output to color.Output\nfmt.Fprintf(color.Output, \"Windows support: %s\", color.GreenString(\"PASS\"))\n```\n\n### Plug into existing code\n\n```go\n// Use handy standard colors\ncolor.Set(color.FgYellow)\n\nfmt.Println(\"Existing text will now be in yellow\")\nfmt.Printf(\"This one %s\\n\", \"too\")\n\ncolor.Unset() // Don't forget to unset\n\n// You can mix up parameters\ncolor.Set(color.FgMagenta, color.Bold)\ndefer color.Unset() // Use it in your function\n\nfmt.Println(\"All text will now be bold magenta.\")\n```\n\n### Disable/Enable color\n\nThere might be a case where you want to explicitly disable/enable color output. the\n`go-isatty` package will automatically disable color output for non-tty output streams\n(for example if the output were piped directly to `less`)\n\n`Color` has support to disable/enable colors both globally and for single color\ndefinitions. For example suppose you have a CLI app and a `--no-color` bool flag. You\ncan easily disable the color output with:\n\n```go\n\nvar flagNoColor = flag.Bool(\"no-color\", false, \"Disable color output\")\n\nif *flagNoColor {\n\tcolor.NoColor = true // disables colorized output\n}\n```\n\nIt also has support for single color definitions (local). You can\ndisable/enable color output on the fly:\n\n```go\nc := color.New(color.FgCyan)\nc.Println(\"Prints cyan text\")\n\nc.DisableColor()\nc.Println(\"This is printed without any color\")\n\nc.EnableColor()\nc.Println(\"This prints again cyan...\")\n```\n\n## Todo\n\n* Save/Return previous values\n* Evaluate fmt.Formatter interface\n\n\n## Credits\n\n * [Fatih Arslan](https://github.com/fatih)\n * Windows support via @mattn: [colorable](https://github.com/mattn/go-colorable)\n\n## License\n\nThe MIT License (MIT) - see [`LICENSE.md`](https://github.com/euank/color/blob/master/LICENSE.md) for more details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuank%2Fcolor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feuank%2Fcolor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuank%2Fcolor/lists"}