# How to Enable Colored Output in Holehe

> Enable colored output in Holehe with ease. Simply avoid the --no-color flag to see vibrant status results in your terminal. Learn how to get colorful feedback.

- Repository: [Palenath/holehe](https://github.com/megadose/holehe)
- Tags: how-to-guide
- Published: 2026-09-08

---

**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/main/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/main/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](https://github.com/megadose/holehe/blob/master/holehe/core.py#L107-L113), 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](https://github.com/megadose/holehe/blob/master/holehe/core.py#L186-L187)) 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-color` argument in your command.
- Verify that no shell alias or wrapper script injects `--no-color` automatically.

Example commands:

```bash

# 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:

```bash
FORCE_COLOR=1 holehe target@example.com | less -R

```

## Summary

- Colored output is the default state in Holehe and is controlled via the `args.nocolor` boolean.
- The formatting logic is implemented in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) within the `print_color()` function (lines 107-113).
- Passing `--no-color` sets `args.nocolor` to True and disables all ANSI codes.
- Use `FORCE_COLOR=1` to 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`](https://github.com/megadose/holehe/blob/main/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`](https://github.com/megadose/holehe/blob/main/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/main/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.