TUI: orderbook renders unreadable colours on macOS Terminal.app (truecolor RGB not supported)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu với crates/cdcx-tui/src/theme.rs và lần theo các vị trí gọi Color::Rgb được nêu trong widgets/detail_view.rs, tabs/market.rs và ticker_tape.rs. Chạy cargo run -p cdcx-cli --release -- tui và tái hiện orderbook trong Terminal.app, sau đó xác minh rằng hành vi fallback vẫn giữ nguyên các màu hiện tại trên các terminal truecolor và giúp các terminal smoke-test được liệt kê hiển thị dễ đọc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 27
- Fork
- 9
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của crypto-com/cdcx-cli
-
TUI: press Enter on book-cursor level to prefill place-order modalCó thể đã có người làm @llcro đã nhận 183 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
crypto-com/cdcx-cli#34 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
crypto-com/cdcx-cli#32 ·
Tất cả issue của crypto-com/cdcx-cli
Issue tương tự
-
bug priority: low ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
storytold/gridcraft#3446 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
seabeectl verify exits 0 when verification failsCó thể đã có người làm @theyottaboy đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NationalSecurityAgency/seabee#73 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
neilsh/stunt-reel#220 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày