# getColorEnabledAsync

**Kind:** Function

**Source:** [`src/utils/color.ts`](https://github.com/honojs/hono/blob/main/src/utils/color.ts#L36)

**Part of:** [Utils](subsystem-src-utils)

Get whether color change on terminal is enabled or disabled.
If `NO_COLOR` environment variable is set, this function returns `false`.

`getColorEnabledAsync` asynchronously determines whether terminal color changes are enabled. When the `NO_COLOR` environment variable is set, it returns `false` so callers can avoid emitting color formatting.

## Signature

```ts
async function getColorEnabledAsync(): Promise<boolean>
```

**Returns:** `Promise<boolean>`

## Diagram

```mermaid
graph LR
  A[Caller] --> B[getColorEnabledAsync]
  B --> C{NO_COLOR set?}
  C -->|Yes| D[Return false]
  C -->|No| E[Return color-enabled status]
```

## Usage

```ts
import { getColorEnabledAsync } from './utils/color';

const colorEnabled = await getColorEnabledAsync();

if (colorEnabled) {
  console.log('\u001b[32mSuccess\u001b[0m');
} else {
  console.log('Success');
}
```

## AI Coding Instructions

- Always `await` `getColorEnabledAsync` before deciding whether to write terminal color escape sequences.
- Respect a `false` result and emit plain text when color changes are disabled.
- Do not override the `NO_COLOR` environment variable behavior in calling code.
- Keep terminal output formatting decisions close to the code that writes to the terminal.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (1)

- `logger` — `src/middleware/logger/index.ts`:81
