Add option to use color codes in non-tty contexts

This adds the `--color=<when>` option to the command to specify when the output should be colorized, where `<when>` is either `auto`, `always` or `never`.

Fixes #325.