Color lets you use colorized outputs in terms of ANSI Escape Codes in Go (Golang). It has support for Windows too! The API can be used in several ways, pick one that suits you. There might be a case where you want to explicitly disable/enable color output. the go-isatty package will automatically disable color output for non-tty output streams (for example if the output were piped directly to less). The color package also disables color output if the NO_COLOR environment variable is set (regardless of its value). Color has support to disable/enable colors programatically both globally and for single color definitions. For example suppose you have a CLI app and a --no-color bool flag. It also has support for single color definitions (local). You can disable/enable color output on the fly. To output color in GitHub Actions (or other CI systems that support ANSI colors), make sure to set color.NoColor = false so that it bypasses the check for non-tty output streams.

Features

  • Mix and reuse colors
  • Use your own output (io.Writer)
  • Custom print functions (PrintFunc)
  • Custom fprint functions (FprintFunc)
  • Insert into noncolor strings (SprintFunc)
  • Plug into existing code

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow color

color Web Site

Other Useful Business Software
$300 Free Credits for Your Google Cloud Projects Icon
$300 Free Credits for Your Google Cloud Projects

Start building on Google Cloud with $300 in free credits. No commitment, no credit card required until you're ready to scale.

Launch your next project with $300 in free Google Cloud credits—no strings attached. Test, build, and deploy without risk. Use your credits across the entire Google Cloud platform to find what works best for your needs. After your credits are used, continue with always-free tier services. Only pay when you're ready to scale. Sign up in minutes and start exploring.
Start Free Trial
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of color!

Additional Project Details

Operating Systems

Windows

Programming Language

Go

Related Categories

Go User Interface (UI) Software

Registered

2021-11-11