#command-line-tool #terminal #pipeline

app pipecolor

A terminal filter to colorize output

14 releases

0.4.4 May 16, 2023
0.4.3 May 16, 2023
0.4.2 Nov 13, 2019
0.4.0 May 3, 2018
0.1.1 Mar 30, 2018

#3 in #pipeline

45 downloads per month

MIT license

512 lines


A terminal filter to colorize output

Actions Status Crates.io codecov


pipecolor is a terminal filter to colorize output. You can customize the colorize rule by regular expression.




Download from release page, and extract to the directory in PATH.

Alternatively you can install by cargo.

cargo install pipecolor

Put the colorize rule file to ~/.pipecolor.toml.

sample/pipecolor.toml in this repository is an example.


pipecolor can receive input through pipe, and colorize the output.

$ cat sample/access_log | pipecolor -c ./sample/pipecolor.toml

Filenames can be specified.

$ pipecolor -c ./sample/pipecolor.toml sample/maillog

If output is redirected to a file, colorization is disabled automatically. You can force to colorize by pipecolor --mode always.

Colorize rule

See the example rule sample/pipecolor.toml.

    pat  = "^(.*?) .*? .*? \\[(.*?)\\] \".*?\" .*? .*? \".*?\" \"(.*?)\""
    colors = ["White", "LightGreen", "LightBlue", "Green"]
        pat   = "GET"
        colors = ["LightCyan"]
        pat   = "POST"
        colors = ["LightYellow"]
        pat   = "HEAD"
        colors = ["LightMagenta"]

lines.pat is a regular expression to specify colorize lines. If the expression is matched, the matched line is colorize to colors specified by lines.colors.

lines.colors is an array of colors, the first color is used to colorize the whole line. The rest colors are used to colorize the captured group in the expression. In the example, the whole line is colorized to White, the first group captured by (.*?) is colorized to LightGreen.

lines.tokens specifies the special tokens to be colorized in the matched line.

If no token is required, tokens can be empty list.

    pat  = "^(.*?) .*? .*? \\[(.*?)\\] \".*?\" .*? .*? \".*?\" \"(.*?)\""
    colors = ["White", "LightGreen", "LightBlue", "Green"]
    tokens = []

Available colors

The available colors are below.

  • Black
  • Blue
  • Cyan
  • Default
  • Green
  • LightBlack
  • LightBlue
  • LightCyan
  • LightGreen
  • LightMagenta
  • LightRed
  • LightWhite
  • LightYellow
  • Magenta
  • Red
  • White
  • Yellow


~213K SLoC