# How Holehe Uses Color Codes for Terminal Output: A Complete Guide

> Learn how Holehe uses ANSI color codes like green magenta yellow and red for terminal output to easily distinguish email lookup results. Explore the centralized color handling.

- Repository: [Palenath/holehe](https://github.com/megadose/holehe)
- Tags: deep-dive
- Published: 2026-08-30

---

**Holehe uses four ANSI color codes—green, magenta, yellow, and red—to visually distinguish email lookup results, with all color handling centralized in a single helper function.**

The open-source **Holehe** tool by megadose collates results from multiple websites to verify whether an email address is registered on various platforms. Understanding its **color codes for terminal output** helps users quickly interpret scan results without reading every line of text. This article breaks down exactly which colors the tool uses, where they are defined in the source code, and how to disable them when needed.

## Core Color Scheme in Holehe

Holehe leverages the **`termcolor`** library to apply ANSI color codes. The mapping between status symbols and colors is hardcoded in **[`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py)** and remains consistent across all platform modules.

| Symbol | Meaning | ANSI Color |
|--------|---------|------------|
| `[+]` | Email address **found / used** | **green** |
| `[-]` | Email address **not used** | **magenta** |
| `[x]` | **Rate‑limit** response from a site | **yellow** |
| `[!]` | **Error** while checking a site | **red** |

These four symbols precede every result line, making it possible to scan dozens of outputs at a glance.

## Where Colors Are Implemented: holehe/core.py

The `print_color` helper function in **[`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) (lines 107‑113)** wraps `termcolor.colored()` and conditionally applies formatting based on user flags.

```python

# Simplified excerpt from holehe/core.py

from termcolor import colored

def print_color(text, color, args):
    if args.nocolor == False:
        return colored(text, color)   # termcolor injects ANSI escape codes

    return text

```

This function is called whenever Holehe assembles a result string. The `color` parameter receives one of four string literals: `"green"`, `"magenta"`, `"yellow"`, or `"red"`.

## Building the Colored Description

Holehe constructs its terminal output by concatenating colorized tokens. The following pattern appears throughout the codebase:

```python
description = (
    print_color("[+] Email used", "green", args) + ", " +
    print_color("[-] Email not used", "magenta", args) + ", " +
    print_color("[x] Rate limit", "yellow", args) + ", " +
    print_color("[!] Error", "red", args)
)
print(description)

```

- **`termcolor`** translates the color names into platform-appropriate ANSI sequences.
- The `args` object carries the `--no-color` flag state passed from the CLI.
- Plain text fallback occurs automatically when colors are disabled.

## Disabling Color Output

Users who prefer unformatted text—such as when piping output to another tool or reading logs in a monochrome environment—can invoke **Holehe** with:

```bash
holehe example@email.com --no-color

```

Internally, this sets `args.nocolor = True`, causing `print_color` to return raw strings without ANSI codes.

## Key Files in the Color System

| File | Responsibility |
|------|----------------|
| **[`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py)** | Contains `print_color()` and all color-related logic |
| **[`setup.py`](https://github.com/megadose/holehe/blob/main/setup.py)** | Declares `termcolor` as an install dependency |
| **[`holehe/__init__.py`](https://github.com/megadose/holehe/blob/main/holehe/__init__.py)** | Exposes the CLI entry point that propagates `--no-color` to [`core.py`](https://github.com/megadose/holehe/blob/main/core.py) |

## Summary

- Holehe uses **four ANSI colors** for terminal output: **green** for found emails, **magenta** for unused emails, **yellow** for rate limits, and **red** for errors.
- The **`print_color`** function in **[`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py)** centralizes all color handling using the **`termcolor`** library.
- Color output can be disabled via the **`--no-color`** flag, which bypasses `termcolor` entirely.
- Source file paths and function names are consistent across the repository, making the color system easy to audit or modify.

## Frequently Asked Questions

### What color does Holehe use when an email is found on a site?

Holehe displays **`[+]` in green** when an email address is registered on a platform. This is the most common positive indicator and uses the `"green"` ANSI color name passed to `termcolor.colored()` in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py).

### Why does Holehe use magenta instead of red for "email not used"?

Holehe reserves **red** for actual **errors (`[!]`)** and uses **magenta** for `[-]` ("email not used") to avoid alarming users. This color choice is hardcoded in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) and distinguishes a negative result from a system failure.

### How can I save Holehe output without ANSI color codes?

Run Holehe with **`--no-color`** or **`--no‑color`** to disable all terminal formatting. The `print_color` function detects `args.nocolor == True` and returns plain strings, making the output safe for piping to files or other Unix tools.

### Does Holehe support custom color schemes?

No—the **color codes are fixed** in the current implementation. The `print_color` function accepts only the four predefined color names (`green`, `magenta`, `yellow`, `red`) as defined in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py). Users who need custom formatting must modify the source or post-process the output.