COLORIZE(1)

NAME
colorize - colorize text on terminal with ANSI escape sequences

SYNOPSIS
colorize [option]... (foreground) [-|file]

colorize [option]... (foreground)/(background) [-|file]

colorize --clean[-all] [-|file]

colorize -hV

DESCRIPTION
Colorizes text read from standard input stream or file by using ANSI escape sequences (and also vice versa, i.e. cleaning text from sequences) and prints resulting output to the terminal.

When colorizing text, (foreground) and eventually (background) may be either one of following color values: none, black, red, green, yellow, blue, magenta, cyan, white, default or random. First character of color name in upper case denotes increased intensity, whereas for lower case colors will be of normal intensity. If "none" is chosen, no escape sequences will be emitted.

Color escape sequences are added per each line, hence colored lines can be safely extracted.

When de-colorizing text, --clean omits color escape sequences which were emitted by colorize (see NOTES for list), whereas --clean-all omits all valid ones. If in doubt, consider using --clean-all.

OPTIONS

--attr=ATTR1,ATTR2,...
    set attributes by name
    Attributes: bold, underscore, blink, reverse and concealed.

--clean
    clean text from color escape sequences emitted by colorize

--clean-all
    clean text from all valid color escape sequences

-c, --config=PATH
    alternate configuration file location

--exclude-random=COLOR
    text color to be excluded when selecting a random foreground color

--omit-color-empty
    omit printing color escape sequences for empty lines

-h, --help
    show help screen and exit

-V, --version
    display version data and exit

FILES

~/.colorize.conf
    user configuration file

    If the aforementioned file exists, it is read, parsed and processed prior to handling the command-line options. Command-line options override configuration values, but are currently not capable of unsetting them. If unsetting is desired, comment them out or remove them.

    Sample configuration file
        # ~/.colorize.conf
        attr = bold,underscore
        color = magenta # favorite one
        exclude-random = black
        omit-color-empty = yes

    Configurable options and values
        attr             (values same as command-line option)
        color            (value  same as command-line colors)
        exclude-random   (value  same as command-line option)
        omit-color-empty (yes/no)

    Syntax
        Each line ought to start with a name of an option, followed by = and an optional value. Leaving the value blank, unsets the option.

        Whitespace is allowed before the option name, after the option name, before the option value and after the option value.

        Comments may be placed before or after the option is set. Everything following the '#' sign is treated as being commented out.

NOTES
The list of color escape sequence codes being emitted and omitted is as follows:

*   30-37,39 (foreground colors)

*   1-9;30-37,39 (foreground colors with attributes)

*   40-47,49 (background colors)

*   0 (reset)

EXAMPLES

$ colorize green /etc/motd
    Print file /etc/motd with green as foreground color

$ colorize green/black /etc/motd
    Print file /etc/motd with green as foreground and black as background color

$ colorize green /etc/motd | colorize --clean
    Print input from stdin with color escape sequences omitted

$ git log -1 -p --color | colorize --clean-all
    Print input from stdin with all color escape sequences omitted

$ colorize --attr=bold green /etc/motd
    Print file /etc/motd with bold green as foreground color

AUTHOR
Steven Schubiger <stsc@refcnt.org>