Table of Contents
Colors is an ANSI color library in Golang. Hundreds of ANSI color constants are defined for use in terminal applications in need of color. Different color helper functions exist to help convert color values between one another.
Because colors is a standalone project made completely with Go, it can be used in any repository. Simply make sure the prerequisites are met and then follow the installation steps below.
Colors offers hundreds of colors that can only be viewed if your terminal is true color compatable. If you terminal is not true color compatable, it may only be able to render xterm or solarized colors, leading to "different" colors of similar shade to look the exact same.
- Golang is installed
- Git is installed
To include the Colors package in your own Golang application, include the line import "github.com/ethanbaker/colors"
.
If you want to use css colors, solarized colors, or xterm colors specifically in your project, import that sub-project by including the line import "github.com/ethanbaker/colors/SUB_PROJECT"
, where SUB_PROJECT
can be css
, sol
, or xterm
.
To make shell commands from the package, clone the repository and run go install ./...
in the cmd/
directory. Command usage can be found for each command and in the documentation.
When using Colors in your own program, you can easily print a wide range of colors by formatting something like this in your code:
fmt.Println(css.Aqua + "This will print the css color aqua!" + css.AnsiReset)
fmt.Println(sol.Y + "This will print the sol color yellow!" + sol.AnsiReset)
fmt.Println(xterm.Maroon + "This will print the xterm color maroon!" + xterm.AnsiReset)
For more examples, please refer to the documentation.
- CSS Colors
- Color converting utils
- Xterm Colors
See the open issues for a full list of proposed features (and known issues).
For issues and suggestions, please include as much useful information as possible. Review the documentation and make sure the issue is actually present or the suggestion is not included. Please share issues/suggestions on the issue tracker.
For patches and feature additions, please submit them as pull requests. Please adhere to the conventional commits. standard for commit messaging. In addition, please try to name your git branch according to your new patch. These standards are a great guide you can follow.
You can follow these steps below to create a pull request:
- Fork the Project
- Create your Feature Branch (
git checkout -b branch_name
) - Commit your Changes (
git commit -m "commit_message"
) - Push to the Branch (
git push origin branch_name
) - Open a Pull Request
This project uses the Apache 2.0 license.
You can find more information in the LICENSE file.
Ethan Baker - contact@ethanbaker.dev - LinkedIn
Project Link: https://github.com/ethanbaker/colors
- @rwxrob for contributing and starting off this project