# How to Disable Colored Output in holehe: CLI and Programmatic Methods

> Easily disable colored output in holehe using the --no-color flag or programmatically setting args.nocolor to True. Control CLI and library color display.

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

---

**Add the `--no-color` flag when running holehe from the command line, or set `args.nocolor = True` when using the library programmatically to disable all ANSI color output.**

The open-source OSINT tool **holehe** (maintained by megadose/holehe) uses ANSI color codes to highlight results in terminal output. When you need to disable colored output in holehe for logging, piping to other tools, or accessibility reasons, the tool provides both command-line and programmatic options to strip all colorization.

## How holehe Implements Color Output

holehe leverages the **termcolor** library to generate ANSI color codes for terminal output. The core logic resides in the `print_color` function within [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py), which checks the `args.nocolor` attribute before applying any formatting.

According to the source code in megadose/holehe, when `args.nocolor` is set to `True`, the function returns the raw text string without invoking `termcolor.colored`, effectively bypassing all colorization at lines 108-109 in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py).

## Disabling Colors via Command Line

The simplest method to disable colored output is using the built-in command-line flag. The argument parser in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) defines `--no-color` as a boolean flag that stores `True` to the `args.nocolor` destination (line 186).

```bash
holehe -u example@domain.com --no-color

```

When this flag is present, every call to `print_color` returns plain text instead of colorized strings, making the output suitable for redirection to files or processing by other Unix tools like `grep` or `awk`.

## Disabling Colors Programmatically

When integrating holehe into Python scripts, you must configure the `args` namespace passed to internal functions. Create an args object with `nocolor` set to `True` to ensure all output returns as plain text without ANSI escape sequences.

```python
from holehe.core import print_color

# Configure args to disable color output

class Args:
    nocolor = True

args = Args()

# Returns "Sample text" without green ANSI codes

result = print_color("Sample text", "green", args)
print(result)  # Output: Sample text (plain)

```

This approach is essential when capturing holehe output programmatically or displaying results in environments that do not support ANSI color codes.

## Technical Implementation Details

The color toggle mechanism relies on a conditional check inside the `print_color` function:

- **When `args.nocolor == False`**: Returns `termcolor.colored(text, color)` with full ANSI color codes
- **When `args.nocolor == True`**: Returns the raw `text` string unchanged

The CLI argument registration at line 186 of [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) defines the interface:

```python
parser.add_argument("--no-color", action="store_true", dest="nocolor", help="Don't color terminal output")

```

The [`setup.py`](https://github.com/megadose/holehe/blob/main/setup.py) file in the repository declares **termcolor** and **colorama** as dependencies, ensuring cross-platform color support. Disabling colors via the `nocolor` attribute bypasses these libraries entirely while preserving all functional OSINT capabilities.

## Summary

- Use the `--no-color` flag when running holehe from the terminal to disable all ANSI colors
- Set `args.nocolor = True` in your Python code when using holehe as an imported library
- The `print_color` function in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) handles the conditional logic at lines 108-109
- Disabling colors removes terminal formatting but does not affect API requests or data processing results

## Frequently Asked Questions

### What library does holehe use for colored terminal output?

holehe uses the **termcolor** library to generate ANSI color codes, with **colorama** listed as a dependency in [`setup.py`](https://github.com/megadose/holehe/blob/main/setup.py) to ensure cross-platform color support on Windows systems.

### Can I permanently disable colors without typing the flag every time?

holehe does not currently support environment variables or configuration files for default settings. To permanently disable colors, create a shell alias such as `alias holehe='holehe --no-color'` in your `.bashrc` or `.zshrc` configuration file.

### Does disabling colored output affect functionality or performance?

No. Disabling colors only affects the visual presentation layer handled by `print_color` in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py). All OSINT functionality, API requests, rate limiting, and data processing remain identical; only the terminal output lacks ANSI escape sequences.

### Where exactly is the color logic implemented in the holehe source code?

The color toggle logic resides in the `print_color` function at lines 108-109 of [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py), while the command-line argument parser defines the `--no-color` flag at line 186 of the same file according to the megadose/holehe repository source code.