clout is a small Unix utility that colorizes the standard output and standard error streams of a command independently.
It executes a command, captures its standard output and standard error through separate pipes, and writes each stream using a configurable ANSI color. By default, stdout is green and stderr is red.
The project is written in C and uses fundamental Unix process and I/O interfaces, including fork(2), execvp(3), pipe(2), dup2(2), and poll(2).
- Execute commands using
execvp(3). - Capture stdout and stderr through separate pipes.
- Colorize stdout and stderr independently.
- Select the stdout color with
-o. - Select the stderr color with
-e. - Read both output streams using
poll(2). - Handle nonblocking pipe I/O.
- Propagate the command's exit status.
- Report
128 + signal numberwhen the command terminates due to a signal. - Provide a built-in usage message with
-h. - Include a manual page.
clout [-h] [-e color] [-o color] command [argument ...]The default colors are:
- stdout: green
- stderr: red
Run a command with the default colors:
clout ls /Set the stdout color:
clout -o cyan ls /Set the stderr color:
clout -e yellow sh -c 'echo "error" >&2'Configure both streams independently:
clout -o green -e red sh -c 'echo "output"; echo "error" >&2'Display usage information:
clout -hThe following colors are supported:
- black
- red
- green
- yellow
- blue
- purple
- cyan
- white
- gray
- bright-red
- bright-green
- bright-yellow
- bright-blue
- bright-purple
- bright-cyan
- bright-white
clout uses a standard Makefile and does not require an external build system.
Build:
makeClean build artifacts:
make cleanThe manual page is available as clout(1).
Read it directly from the source tree:
man ./clout.1Render it with mandoc:
mandoc clout.1Check the manual page for errors:
mandoc -T lint clout.1Copyright (C) 2026 Mahdi Feyzolahy
License: BSD-2-Clause
See the LICENSE file for the full license text.