How to Enable Colored Output in Holehe
Colored terminal output is enabled by default in Holehe; simply omit the --no-color flag to maintain ANSI color coding for result statuses.
Holehe is an open-source email OSINT tool that checks for account registrations across hundreds of platforms. Understanding how to enable and preserve colored output helps operators quickly interpret results at a glance, distinguishing successful registrations from rate limits and errors.
How Colored Output Works in Holehe
Holehe leverages the termcolor library to inject ANSI color codes into CLI output. The dependency is declared in [setup.py](https://github.com/megadose/holehe/blob/master/setup.py), ensuring the package is installed alongside the tool.
The core logic resides in [holehe/core.py](https://github.com/megadose/holehe/blob/master/holehe/core.py). The print_color() function wraps termcolor.colored() and returns a colorized string only when the nocolor attribute is False. As implemented in lines 107-113, the function checks args.nocolor before applying formatting.
Ensuring Colored Output Is Enabled
By design, colors require no explicit flag to activate. The argument parser defines a --no-color flag (lines 186-187) that sets args.nocolor to True when provided. Because the flag defaults to false, omitting it leaves colors fully enabled.
To ensure colored output remains active:
- Do not include the
--no-colorargument in your command. - Verify that no shell alias or wrapper script injects
--no-colorautomatically.
Example commands:
# Default behavior: colors enabled
holehe target@example.com
# Explicitly disabling colors
holehe target@example.com --no-color
Preserving Colors in Non-Interactive Environments
When piping output to files or running in CI environments, the underlying termcolor library may auto-detect the non-TTY environment and strip ANSI codes to prevent control characters in logs. To force color retention when redirecting output, set the FORCE_COLOR environment variable before invocation:
FORCE_COLOR=1 holehe target@example.com | less -R
Summary
- Colored output is the default state in Holehe and is controlled via the
args.nocolorboolean. - The formatting logic is implemented in
holehe/core.pywithin theprint_color()function (lines 107-113). - Passing
--no-colorsetsargs.nocolorto True and disables all ANSI codes. - Use
FORCE_COLOR=1to override TTY detection and preserve colors when piping output.
Frequently Asked Questions
Is colored output enabled by default in Holehe?
Yes. The tool automatically applies ANSI colors to terminal results unless you explicitly pass the --no-color flag. The default configuration in holehe/core.py keeps args.nocolor set to False, ensuring green, magenta, yellow, and red status indicators appear without additional configuration.
How do I disable colored output for logging purposes?
Append the --no-color argument to your command: holehe email@example.com --no-color. This sets the internal nocolor attribute to True, causing the print_color() function in holehe/core.py to return plain text strings instead of colorized output.
Why does holehe output lose colors when redirected to a file?
The underlying termcolor library detects non-interactive environments (like pipes or file redirects) and suppresses ANSI codes to prevent garbage characters in logs. To retain colors when piping, set the FORCE_COLOR=1 environment variable before running the command.
Which file contains the color formatting logic?
The color handling is defined in [holehe/core.py](https://github.com/megadose/holehe/blob/master/holehe/core.py), specifically within the print_color() function around lines 107-113. This function conditionally wraps text using the termcolor library based on the args.nocolor boolean.
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 →