https://github.com/eproxus/color
Shell ANSI coloring for erlang
https://github.com/eproxus/color
Last synced: about 1 year ago
JSON representation
Shell ANSI coloring for erlang
- Host: GitHub
- URL: https://github.com/eproxus/color
- Owner: eproxus
- License: mit
- Created: 2014-03-06T12:35:47.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2021-04-21T12:21:17.000Z (about 5 years ago)
- Last Synced: 2025-03-24T05:26:26.920Z (about 1 year ago)
- Language: Erlang
- Homepage:
- Size: 301 KB
- Stars: 11
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Color #
Shell ANSI coloring for Erlang.
## Usage
Color exports two sets of functions, color names and a generic formatting
function (`p`). Both functions takes IO data and returns IO data (they never
print anything themselves). The following colors are supported as functions:
* `black`
* `red`
* `green`
* `yellow`
* `blue`
* `purple`
* `cyan`
* `white`
They can be called directly, e.g. `color:yellow(IOData)`. The generic
formatting function `p` takes two arguments, IO data and options. In addition
to the colors above, it also supports:
* `light_black`
* `light_red`
* `light_green`
* `light_yellow`
* `light_blue`
* `light_purple`
* `light_cyan`
* `light_white`
It also supports several modes:
* `normal`
* `bold`
* `underline`
* `blink`
The options list can be any combination of these colors or modes.
To assign a background color, simple include two colors. The first will be used
as the foreground color, and the second will be used as the background color
(to set only the background color, include `inherit` as the foreground color).
Examples:
* `color:p("text", [yellow])` (same as `color:yellow("text")`)
* `color:p("text", [green, red, bold])` (bold green text on red background)
* `color:p("text", [inherit, blue])` (normal text on blue background)
* `color:p("text", [bold, underline])` (normal bold and underlined text)
## Modules ##