Feature: WASM terminal should respect theme palette for ANSI colors
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
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- typescript, wasm
Hướng nghiên cứu
Theo dõi cách trình phân tích cú pháp WASM phân giải các mã màu ANSI và cách renderer.renderCell sử dụng các màu đã được phân giải đó, bắt đầu từ quá trình khởi tạo theme của Terminal. So sánh các cách tiếp cận được đề xuất là truyền palette và sử dụng chỉ mục màu, sau đó xác minh rằng màu ANSI sử dụng theme đã cấu hình thay vì Tomorrow Night mà không yêu cầu remapping cho từng ô.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The WASM terminal parser/renderer has a hardcoded color palette (Tomorrow Night) that doesn't respect the theme passed to the Terminal constructor. When an application sends ANSI color codes, they get resolved to Tomorrow Night RGB values regardless of the configured theme.
Current Behavior
When creating a terminal with a custom theme:
const terminal = new Terminal({
theme: {
background: '#002b36', // solarized
foreground: '#839496',
green: '#859900',
// ...
}
});
The WASM parser still outputs Tomorrow Night colors (e.g., #b5bd68 for green instead of #859900), because the internal WASM module resolves ANSI codes to its built-in palette.
The renderer uses the theme for canvas background/cursor/selection, but text colors come pre-resolved from WASM.
Expected Behavior
ANSI color codes should resolve to the user's configured theme palette, not the hardcoded Tomorrow Night palette.
Workaround
We currently patch renderer.renderCell to intercept and remap colors from Tomorrow Night → custom theme using a color map. This works but requires knowing the exact Tomorrow Night palette values and adds overhead to every cell render.
Proposed Solutions
- Pass theme palette to WASM - Allow the palette to be configured when initializing the WASM module
- Return color indices - Have WASM return ANSI color indices (0-15) rather than resolved RGB, letting the renderer resolve them
- Document the internal palette - At minimum, document that Tomorrow Night is the hardcoded palette so consumers can build their own remapping
Option 2 would be cleanest as it separates parsing from rendering.
Environment
- ghostty-web: 0.4.0
- Browser: All
Filed from textual-webterm project where we encountered this while implementing theme support
- Ngôn ngữ chính
- TypeScript
- Star
- 2.9k
- Fork
- 174
- 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
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. 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 coder/ghostty-web
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
coder/ghostty-web#199 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
coder/ghostty-web#198 ·
-
attachCustomKeyEventHandler inverts xterm.js's return-value contract (silently swallows all input)Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
coder/ghostty-web#192 ·
-
A single throw inside render() permanently stops the render loop, and a consumer cannot restart itĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 65/100
coder/ghostty-web#189 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
coder/ghostty-web#188 ·
Tất cả issue của coder/ghostty-web
Issue tương tự
-
needs:triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-discovered
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/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 88/100
jessepollak/home#1627 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent-canvas bug llm priority:low ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
OpenHands/OpenHands#17806 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
radius-project/ai-extensions#923 ·
Maintainer thường phản hồi trong vòng 1 ngày