Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Feature: WASM terminal should respect theme palette for ANSI colors

Đang mở
#121 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Lĩnh vực
frontend, web-dev

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

  1. Pass theme palette to WASM - Allow the palette to be configured when initializing the WASM module
  2. Return color indices - Have WASM return ANSI color indices (0-15) rather than resolved RGB, letting the renderer resolve them
  3. 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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của coder/ghostty-web

Tất cả issue của coder/ghostty-web

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.