reference Environment variables

NO_COLOR

Also spelled
OPENGREP_FORCE_NO_COLOR, SEMGREP_FORCE_NO_COLOR
Value
any non-empty value
See also
--force-color, OPENGREP_FORCE_COLOR

Any non-empty value turns off color, bold and other styling in the output and in the logs, as described at no-color.org. OPENGREP_FORCE_NO_COLOR and SEMGREP_FORCE_NO_COLOR have the same effect.

Opengrep decides on styling separately for standard output and standard error, in this order:

  1. --force-color, or OPENGREP_FORCE_COLOR set to a true value, turns styling on.
  2. Otherwise, NO_COLOR or OPENGREP_FORCE_NO_COLOR turns it off.
  3. Otherwise, the output is styled only when standard output is a terminal, and the logs only when standard error is one. A text report written to a file is not styled.

Examples

--force-color takes precedence

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
app.py
eval(code)
Command and result
$ NO_COLOR=1 opengrep scan --config rule.yaml --force-color app.py | grep -q $'\e\[' && echo styled || echo plain
styled