Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ethanbaker/colors

All-things colors for golang
https://github.com/ethanbaker/colors

ansi cmyk color colors golang hex hsl hsv rgb

Last synced: about 2 months ago
JSON representation

All-things colors for golang

Awesome Lists containing this project

README

        

![1.0.0](https://img.shields.io/badge/status-1.0.0-red)
[![GoDoc](https://godoc.org/github.com/ethanbaker/colors?status.svg)](https://godoc.org/github.com/ethanbaker/colors)
[![Go Report Card](https://goreportcard.com/badge/github.com/ethanbaker/colors)](https://goreportcard.com/report/github.com/ethanbaker/colors)
[![Go Coverage](https://github.com/ethanbaker/colors/wiki/coverage.svg)](https://raw.githack.com/wiki/ethanbaker/colors/coverage.html)
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]







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

* [Golang](https://go.dev/)

(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](https://unix.stackexchange.com/questions/450365/check-if-terminal-supports-24-bit-true-color). 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][documentation-url].

(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:

```go
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][documentation-url]._

(back to top)

## Roadmap

- [x] CSS Colors
- [x] Color converting utils
- [x] Xterm Colors

See the [open issues][issues-url] 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][documentation-url] and make sure the issue is actually
present or the suggestion is not included. Please share issues/suggestions on the
[issue tracker][issues-url].

For patches and feature additions, please submit them as [pull requests][pulls-url].
Please adhere to the [conventional commits][conventional-commits-url]. standard for
commit messaging. In addition, please try to name your git branch according to your
new patch. [These standards][conventional-branches-url] 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][license-url] file.

(back to top)

## Contact

Ethan Baker - [email protected] - [LinkedIn][linkedin-url]

Project Link: [https://github.com/ethanbaker/colors][project-url]

(back to top)

## Acknowledgments

* [@rwxrob](https://github.com/rwxrob) for contributing and starting off this project

(back to top)

[contributors-shield]: https://img.shields.io/github/contributors/ethanbaker/colors.svg
[forks-shield]: https://img.shields.io/github/forks/ethanbaker/colors.svg
[stars-shield]: https://img.shields.io/github/stars/ethanbaker/colors.svg
[issues-shield]: https://img.shields.io/github/issues/ethanbaker/colors.svg
[license-shield]: https://img.shields.io/github/license/ethanbaker/colors.svg
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?logo=linkedin&colorB=555

[contributors-url]:
[forks-url]:
[stars-url]:
[issues-url]:
[pulls-url]:
[license-url]:
[linkedin-url]:
[project-url]:

[product-screenshot]: path_to_demo
[documentation-url]:

[conventional-commits-url]:
[conventional-branches-url]: