new: Color support for dig using terminal escape sequences
This MR adds initial color support for dig using ANSI escape sequences.
It's very barebones, the flag -C
makes dig
color the status/rcode using one simple foreground color. I have personally found this very useful for quickly noticing error rcodes. I've also updated the documentation to mention this feature, using similar wording as other utilities.
NOERROR
is green, REFUSED
and other "errors" are red, the rest are yellow (and return codes without a name have a yellow background).
For simplicity I did not implement:
- Terminal (emulator) detection to automatically enable colors
- Using environment variables to override colors
- Coloring other output or other errors
I tried to keep the amount of changes as minimal as possible in this first iteration. Coloring other errors would be the next step, if that's okay.
Feedback very welcome.