# save_terminal_theme_mapping

> **Function** in `deepagents_code`

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

Persist a `[ui.terminal_themes][term_program] = name` entry.

The write is atomic (temp file + `Path.replace`) to avoid corrupting
`config.toml` on crash or SIGINT. Mirrors `save_theme_preference`.

## Signature

```python
save_terminal_theme_mapping(
    term_program: str,
    name: str,
) -> bool
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `term_program` | `str` | Yes | Value of the `TERM_PROGRAM` environment variable to key on. Whitespace is stripped; the trimmed value is matched verbatim against `os.environ["TERM_PROGRAM"]` at lookup time. |
| `name` | `str` | Yes | Theme name to map. Validated as an exact registry-key match — labels and case variants are rejected here because the picker writes canonical keys. |

## Returns

`bool`

`True` if the mapping was saved, `False` if `name` isn't a registered
theme, `term_program` is empty after stripping, or any error
occurred.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/a98f0dfa8d534d8a1885b524632400e52db22ac6/libs/code/deepagents_code/app.py#L749)