# set_terminal_background

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/terminal_escape/set_terminal_background)

Set the terminal's dynamic default background color with `OSC 11`.

This is cosmetic and intentionally best-effort. Terminals that don't
support `OSC 11` ignore it. `OSC 111` restores the default background at
shutdown, but only when this call succeeds.

Apple Terminal applies the `OSC 11` background but does not restore the
original background on `OSC 111`. Callers that must not leave a changed
background behind must skip Apple Terminal.

## Signature

```python
set_terminal_background(
    color: str,
) -> bool
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `color` | `str` | Yes | Terminal color payload, usually a CSS-style hex color such as `#11121D`. |

## Returns

`bool`

`True` if the sequence was written.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/2069079e09546060f5b52b2cd4f0e3c813e820f3/libs/code/deepagents_code/terminal_escape.py#L237)