colors
colors
Default: auto
Whether enable or disable colorful output of Lefthook. This option can be overwritten with --colors option. You can also provide your own color codes.
With the default auto value colors are enabled only when Lefthook detects a color capable terminal. Setting the option (or --colors) to on forces colors even when the output is not a terminal, e.g. in CI.
When colors are enabled explicitly Lefthook also sets CLICOLOR_FORCE=1 for the commands it runs, so tools like ESLint, Prettier, or Cargo keep their colors when their output is piped. An existing CLICOLOR_FORCE is never overwritten.
Example
Disable colors.
# lefthook.yml
colors: false
Custom color codes. Can be hex or ANSI codes.
# lefthook.yml
colors:
cyan: 14
gray: 244
green: '#32CD32'
red: '#FF1493'
yellow: '#F0E68C'
Control via ENV variable.
- Set
NO_COLOR=trueto disable colored output in lefthook and all subcommands that lefthook calls. - Set
CLICOLOR_FORCE=trueto force colored output in lefthook and all subcommands.