Skip to content

ethanbaker/colors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

1.0.0 GoDoc Go Report Card Go Coverage Contributors Forks Stargazers Issues License LinkedIn




Logo

Colors

ANSI Terminal Color in Golang, for Golang

Table of Contents
  1. About
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About

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.

(back to top)

Built With

(back to top)

Getting Started

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.

Prerequisites

  • Golang is installed
  • Git is installed

Installation

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.

(back to top)

Usage

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.

(back to top)

Roadmap

  • CSS Colors
  • Color converting utils
  • Xterm Colors

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

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:

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b branch_name)
  3. Commit your Changes (git commit -m "commit_message")
  4. Push to the Branch (git push origin branch_name)
  5. Open a Pull Request

(back to top)

License

This project uses the Apache 2.0 license.

You can find more information in the LICENSE file.

(back to top)

Contact

Ethan Baker - contact@ethanbaker.dev - LinkedIn

Project Link: https://github.com/ethanbaker/colors

(back to top)

Acknowledgments

  • @rwxrob for contributing and starting off this project

(back to top)