https://github.com/adrg/color
Colorize output of shell commands
https://github.com/adrg/color
cli color golang shell terminal
Last synced: 3 months ago
JSON representation
Colorize output of shell commands
- Host: GitHub
- URL: https://github.com/adrg/color
- Owner: adrg
- License: mit
- Created: 2014-10-28T15:29:22.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-11-02T18:01:34.000Z (over 3 years ago)
- Last Synced: 2024-10-27T11:14:41.856Z (4 months ago)
- Topics: cli, color, golang, shell, terminal
- Language: Go
- Size: 15.6 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
color
=====
[](https://pkg.go.dev/github.com/adrg/color)
[](http://opensource.org/licenses/MIT)
[](https://goreportcard.com/report/github.com/adrg/color)Color is a small CLI application which provides the ability style text
from the standard input.## Installation
To build use:
```sh
git clone https://github.com/adrg/color.git
cd color
make
```To install system wide use:
```sh
sudo make install
```To uninstall use:
```sh
sudo make uninstall
```### Usage
```sh
input | color [-h] [-v] STYLE...
```### Input format
Parameters can be specified in the input text with '{index}' where index
is a positive number less than the number of styles passed in to color.
Parameter indices can be repeated. To reset the current style use '{r}'.
A reset is automatically applied before each parameter occurence in the
input text. The last '{r}' in the can be omitted as a reset is done at
the end of the input.## Style format
```
foreground:background+attributes
```**Colors**
```
black red green yellow blue magenta cyan white
```**Attributes**
```
b - Bold
d - Dim
i - Italic
u - Underline
B - Blink
f - Fast blink
r - Reverse
h - Hidden
c - Crossed out
```## Examples
```sh
echo "{0}green fg" | color green
echo "{0}blue bg{r}, default bg" | color :blue
echo "{0}yellow fg{r}, default fg, {0}yellow fg again" | color yellow
echo "{0}green fg, red bg, bold" | color green:red+b
echo "{0}underline{r}, {1}bold{r} and {2}reverse" | color +u +b +r
echo "{0}blue fg, red bg, bold, reverse" | color blue:red+br
````
## Contributing
Contributions in the form of pull requests, issues or just general feedback,
are always welcome.
See [CONTRIBUTING.MD](CONTRIBUTING.md).## License
Copyright (c) 2014 Adrian-George Bostan.
This project is licensed under the [MIT license](http://opensource.org/licenses/MIT).
See [LICENSE](LICENSE) for more details.