How to Disable Color Output in the Holehe CLI
Pass the --no-color flag when running the Holehe command-line tool to suppress all ANSI color codes and display plain text output.
The Holehe OSINT tool by megadose uses colored terminal output by default to improve readability when checking email addresses across platforms. If you need to disable color output in the Holehe CLI for logging, piping to other tools, or terminal compatibility reasons, the tool provides a built-in command-line argument. This guide explains how the color system works and how to disable it using the official --no-color option.
How Holehe Handles Terminal Colors
Holehe leverages the termcolor library to apply ANSI color codes to its console output. According to the megadose/holehe source code, the color logic is gated through a helper function called print_color located in holehe/core.py.
When the CLI initializes, it parses arguments to determine whether to apply styling. The argument parser defines the --no-color option at lines 186-187 in holehe/core.py, storing the result in the nocolor destination variable.
The Color Logic Implementation
Inside holehe/core.py, the print_color function (around lines 108-109) checks the args.nocolor boolean before applying any color formatting. If this flag evaluates to True, the function skips the termcolor wrapper and returns plain text instead.
Disabling Colors with the --no-color Flag
To disable color output for a single execution, append the --no-color argument to your Holehe command.
Example with colors (default):
holehe user@example.com
Example without colors:
holehe user@example.com --no-color
This flag works regardless of the email address being checked or the specific modules being invoked.
Making Plain Output the Default
If you consistently need unformatted output, creating a shell alias prevents you from typing the flag repeatedly. Add the following to your .bashrc, .zshrc, or equivalent configuration file:
alias holehe='holehe --no-color'
After reloading your shell configuration, every invocation of holehe will automatically use the --no-color setting.
Technical Source Code Reference
The color control mechanism relies on two specific locations in holehe/core.py:
- Lines 186-187: The argument parser adds the
--no-coloroption withdest='nocolor', creating a boolean toggle accessible throughout the application. - Lines 108-109: The
print_colorhelper function referencesargs.nocolorto conditionally bypass the termcolor formatting calls.
Additionally, setup.py in the repository root lists termcolor as a dependency, confirming the external library responsible for the styling capabilities.
Summary
- Holehe uses the termcolor library for ANSI color formatting as implemented in megadose/holehe.
- Pass
--no-colorto any Holehe command to disable colored output. - The flag is processed in
holehe/core.pyat lines 186-187 and enforced in theprint_colorfunction at lines 108-109. - Create a shell alias to make plain text the default behavior.
Frequently Asked Questions
What is the exact command-line flag to disable colors in Holehe?
Use the --no-color flag. This argument sets the internal nocolor variable to True, which prevents the print_color helper from wrapping text in ANSI codes according to the logic in holehe/core.py.
Can I disable Holehe colors using an environment variable?
Based on the source code in holehe/core.py, Holehe does not check environment variables like NO_COLOR or FORCE_COLOR. Color suppression is only triggered by the explicit --no-color CLI argument parsed by the argument parser at lines 186-187.
Which source file contains the logic for Holehe's color output?
The primary logic resides in holehe/core.py. This file defines both the CLI argument parser (lines 186-187) and the print_color function (lines 108-109) that conditionally applies colors based on the args.nocolor flag.
Does disabling colors improve Holehe's performance?
Disabling colors may offer negligible performance benefits by skipping termcolor function calls in print_color, but the primary benefit is compatibility with log files, pipes, and terminals that do not support ANSI escape sequences.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →