Skip to content

Colour

lemano colours the text it prints for people, sparingly, and only where someone reads it on a terminal.

WhereColour
A change marker and its line, in a diff or a revert plan+ green, ~ yellow, - red
Lines of a content diffadded green, removed red, hunk headers dim, file headers bold
Section headings (Objects:, Files:, Plan:, Results:, Attribution:)bold
discover RESULTchanged and partial yellow, unreachable and failures red, unchanged dim
Conditions in lists and in summaryyellow, Failed red
Who changed an objectbold
What a revert didapplied green, failed red, skipped yellow
The questions a revert asksbold
An errorerror: red

Columns are padded by the width the text shows, so a table lines up with or without colour.

When colour is off

Colour is written to a stream only when all of these hold:

  • the stream (standard output for the text of a command, standard error for errors) is a terminal;
  • --no-color is not given;
  • NO_COLOR is not set to a value;
  • TERM is not dumb.

FORCE_COLOR, set to anything but empty, 0 or false, turns colour on for a stream that is not a terminal, when TERM is dumb, and over NO_COLOR, so it can be set for one run. --no-color still turns it off, since a flag given on the command line overrides the environment.

The machine formats never carry colour: -o json and -o yaml (and the error that ends such a run), summary -o prometheus, and anything written to a file with --out.