Skip to content

Commit 187236f

Browse files
authored
Fix terminal color support: default TERM=xterm-256color and COLORTERM=truecolor (#6)
* Fix terminal color support: default TERM=xterm-256color and COLORTERM=truecolor * Fix CodeRabbit review issues: localEnv forwarding, docs, README accuracy - Use ${localEnv:TERM:xterm-256color} in remoteEnv to preserve host TERM (e.g., xterm-kitty) instead of unconditionally overriding it - Document TERM and COLORTERM in CLAUDE.md Environment section - Update kitty-terminfo README to clarify VS Code vs non-VS Code behavior - Update CHANGELOG to reflect all fixes --------- Co-authored-by: AnExiledDev <AnExiledDev@users.noreply.github.com>
1 parent 14a302e commit 187236f

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

.devcontainer/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
#### ChromaTerm
1111
- **Regex lookbehinds** — replaced alternation inside lookbehinds (`(?<=[\s(]|^)` and `(?<=commit |merge |...)`) with non-capturing groups containing individual lookbehinds (`(?:(?<=[\s(])|^)` and `(?:(?<=commit )|(?<=merge )|...)`) for PCRE2 compatibility
1212

13+
#### Terminal Color Support
14+
- **devcontainer.json** — added `TERM` and `COLORTERM=truecolor` to `remoteEnv`; Docker defaults to `TERM=xterm` (8 colors) which caused Claude Code and other CLI tools to downgrade rendering
15+
- **devcontainer.json**`TERM` uses `${localEnv:TERM:xterm-256color}` to forward the host terminal type (e.g., `xterm-kitty`) instead of unconditionally overriding it
16+
- **setup-aliases.sh** — added terminal color defaults to managed shell block so tmux panes, `docker exec`, and SSH sessions also get 256-color and truecolor support
17+
- **kitty-terminfo/README.md** — updated documentation to reflect `localEnv` forwarding and clarify behavior across VS Code vs non-VS Code entry points
18+
- **CLAUDE.md** — documented `TERM` and `COLORTERM` environment variables in the Environment section
19+
1320
### Removed
1421

1522
#### VS Code Extensions

.devcontainer/CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ Rules in `config/defaults/rules/` deploy to `.claude/rules/` on every container
7979
| `CLAUDE_CONFIG_DIR` | `/workspaces/.claude` |
8080
| `ANTHROPIC_MODEL` | `claude-opus-4-6` |
8181
| `WORKSPACE_ROOT` | `/workspaces` |
82+
| `TERM` | `${localEnv:TERM:xterm-256color}` (via `remoteEnv` — forwards host TERM, falls back to 256-color) |
83+
| `COLORTERM` | `truecolor` (via `remoteEnv` — enables 24-bit color support) |
8284

8385
All experimental feature flags are in `settings.json` under `env`. Setup steps controlled by boolean flags in `.env`.
8486

.devcontainer/devcontainer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"CLAUDE_CONFIG_DIR": "/workspaces/.claude",
1111
"GH_CONFIG_DIR": "/workspaces/.gh",
1212
"TMPDIR": "/workspaces/.tmp",
13+
"TERM": "${localEnv:TERM:xterm-256color}",
14+
"COLORTERM": "truecolor",
1315
"CLAUDECODE": null
1416
},
1517

.devcontainer/features/kitty-terminfo/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ Downloads and compiles the official kitty terminfo entry from the [Kitty termina
1414

1515
## Usage
1616

17-
No configuration needed. Once installed, containers automatically recognize `TERM=xterm-kitty` and provide full capability support.
17+
The container defaults to `TERM=xterm-256color` with `COLORTERM=truecolor`, which provides full 256-color and 24-bit truecolor support for all terminals.
18+
19+
For Kitty users: the `devcontainer.json` `remoteEnv` uses `${localEnv:TERM:xterm-256color}`, which forwards your host `TERM` into VS Code sessions. If your host sets `TERM=xterm-kitty`, the installed terminfo ensures full Kitty-specific capability support (correct `bce` behavior, status line, etc.). For non-VS Code entry points (tmux, `docker exec`, SSH), `setup-aliases.sh` upgrades `TERM=xterm` to `xterm-256color` but preserves any other value. If no Kitty TERM is forwarded, `xterm-256color` provides equivalent color rendering.
1820

1921
```bash
2022
# Verify installation

.devcontainer/scripts/setup-aliases.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ export GH_CONFIG_DIR="${GH_CONFIG_DIR:-/workspaces/.gh}"
7474
export LANG=en_US.UTF-8
7575
export LC_ALL=en_US.UTF-8
7676
77+
# Terminal color defaults — Docker sets TERM=xterm (8 colors); upgrade to 256-color
78+
if [ "\$TERM" = "xterm" ] || [ -z "\$TERM" ]; then
79+
export TERM=xterm-256color
80+
fi
81+
export COLORTERM="\${COLORTERM:-truecolor}"
82+
7783
# Prefer native binary over npm-installed version
7884
if [ -x "\$HOME/.local/bin/claude" ]; then
7985
_CLAUDE_BIN="\$HOME/.local/bin/claude"

0 commit comments

Comments
 (0)