A small Unix CLI tool that colorizes text from standard input using ANSI terminal escape sequences.
It is designed for use in pipes and shell scripts: color writes the requested ANSI escape sequence to stdout, passes the incoming byte stream through, and resets the terminal color afterwards.
color [-b] [-i] [-f] <color>
| Option | Description |
|---|---|
-b |
Bold output |
-i |
High-intensity output |
-f |
Force color output even when stdout is not a TTY (e.g. when piping into a file or another program) |
-bi |
Bold and high-intensity output |
black · red · green · yellow · blue · pink · cyan · white · reset
The special value reset emits an ANSI reset sequence to restore the terminal's default formatting.
# Red text
echo "Hello, world" | color red
# Bold green text
echo "Success" | color -b green
# High-intensity yellow text
echo "Warning" | color -i yellow
# Bold high-intensity blue text
echo "Information" | color -bi blue
# Bold high-intensity blue, forced even when piped to a file
echo "Information" | color -bif blue > output.txt
# Reset terminal formatting
color reset- GCC or any C99-compatible compiler
- GNU Make
- A terminal with ANSI color support
# Build
make
# Install binary, man pages and bash completion
sudo make installThis installs:
color→/usr/local/bin/color- Man page (English) →
/usr/local/share/man/man1/color.1.gz - Man page (German) →
/usr/local/share/man/de/man1/color.1.gz - Bash completion →
/usr/local/share/bash-completion/completions/color
sudo make uninstallBash completion is installed automatically via make install. After a new shell session, pressing Tab will suggest available colors and options.
If you want to install the completion script manually without installing the binary:
sudo make install_autocompleteAfter installation, the man page is available in English and German:
man color # English
man -L de color # German- By default, color escape sequences are only written when stdout is a TTY. Use
-fto force color output even when piping to a file or another program. - The tool reads from stdin in blocks and is suitable for streaming use cases.
Christian Forler
This README was written by Claude, an AI assistant made by Anthropic.