TUI: orderbook renders unreadable colours on macOS Terminal.app (truecolor RGB not supported)
まだ誰も着手していません。
評価
調査の方向性
crates/cdcx-tui/src/theme.rs から始め、widgets/detail_view.rs、tabs/market.rs、ticker_tape.rs に記載されている Color::Rgb の呼び出し箇所を追跡します。cargo run -p cdcx-cli --release -- tui を実行して Terminal.app で orderbook を再現し、そのうえで、fallback の動作によって truecolor ターミナル上の現在の色が維持され、一覧にある smoke-test ターミナルで読みやすくなることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Reported by
Screenshot attached in thread.
Symptom
On the Market Detail orderbook (and likely other panels), font colours look random — including black-on-dark text that is effectively invisible.
Environment:
- macOS Terminal.app (stock, personal laptop)
- Theme:
terminal-pro(default) - No custom ANSI escape settings in zshrc/bashrc
- Works correctly on a different machine (company MBP — likely iTerm2)
Root cause (high-confidence hypothesis)
macOS Terminal.app does not support 24-bit truecolor ANSI escapes (\e[38;2;R;G;Bm). It is capped at 256-indexed colour. Our themes (crates/cdcx-tui/src/theme.rs) and several widgets emit Color::Rgb(...) unconditionally:
terminal-profg =Color::Rgb(220, 220, 220), bg =Color::Rgb(18, 18, 18), muted =Color::Rgb(120, 120, 120), etc. (theme.rs:50–69)- Orderbook depth bars + heatmap use
Color::Rgbgradients (widgets/detail_view.rs:500–525,tabs/market.rs:1700+) - Pressure-bar background =
Color::Rgb(0, 30, 0)/Color::Rgb(30, 0, 0)(detail_view.rs:355–373)
When Terminal.app receives a truecolor sequence it doesn't understand, behaviour varies: some chunks are dropped, some fall back to default fg (which may be black on his profile), some map poorly — producing the "random" palette Alan is seeing.
The cursor-selected Ask row also uses selected_fg: Color::Black on selected_bg: Color::Rgb(255,180,0); if the bg RGB fails to render but fg Black succeeds, you get black-on-dark → invisible.
Reproduction
- Launch macOS Terminal.app (default settings).
cargo run -p cdcx-cli --release -- tui- Enter Detail view on any instrument.
- Observe orderbook — colours are random, some text is unreadable.
Not reproducible on iTerm2, Ghostty, Alacritty, Kitty, WezTerm (all support truecolor).
Suggested fixes
Ranked by cost/benefit:
-
Detect truecolor support at startup, downgrade to 256-indexed colour when absent.
- Check
$COLORTERM == "truecolor"or"24bit"(standard signalling). - If absent, fall back to a 256-indexed palette: convert every
Color::Rgb(r,g,b)via nearest-256-colour mapping or ship parallel indexed themes. - Smallest user-facing change; no UX regression on capable terminals.
- Check
-
Ship a 256-indexed preset theme (e.g.
terminal-pro-256) and document it in the setup wizard / README — users on Terminal.app pick it explicitly. Simpler to implement but requires user knowledge. -
Hard-guard Terminal.app via
TERM_PROGRAM=Apple_Terminaland auto-swap to the indexed theme. Cheap to detect but narrow.
The right move is probably (1) + a --no-truecolor / tui.force_256 = true override so users whose detection misfires can opt in manually.
Scope of blast radius
Every Color::Rgb call site in crates/cdcx-tui/. Theme definitions in theme.rs are the big one; widget-level gradients (detail_view.rs, market.rs, ticker_tape.rs, heatmap, depth bars) all need the same downgrade path.
Acceptance
- cdcx tui is fully readable on macOS Terminal.app with the default theme.
- Existing truecolor terminals look identical to today.
- Fallback palette documented; override env var / config flag exists.
- Smoke-tested on: Terminal.app, iTerm2, Ghostty, Alacritty.
- 主要言語
- Rust
- スター
- 27
- フォーク
- 9
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crypto-com/cdcx-cli のほかの issue
-
TUI: press Enter on book-cursor level to prefill place-order modal対応中かも @llcro が 183 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
crypto-com/cdcx-cli#34 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
crypto-com/cdcx-cli#32 ·
crypto-com/cdcx-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
nervosnetwork/fiber#1723 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
メンテナーはふだん 1 日以内に返信
-
needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 71/100
pbakaus/impeccable#1314 ·
メンテナーはふだん 1 日以内に返信
-
marmite skill: `curl ... | sh` is the first install method, bypassing review and integrity checksオープン
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
rochacbruno/marmite#565 ·