Add ghostty_config_set_color_scheme C API

RO
6mo ago
+21-0

Companion to cmux #2710 — terminal surfaces losing theme after config reload.

Summary

Adds a new C API, ghostty_config_set_color_scheme, that lets embedders set the config's conditional theme state before finalization so conditional theme resolution (e.g. theme = light:Foo,dark:Bar) uses the correct scheme during ghostty_config_finalize.

Why

Without this, finalization always uses the ConditionalState default (.light), causing embedded apps (cmux) to load the wrong theme colors until a surface color-scheme change triggers re-derivation. The cmux PR that depends on this API is #2710; merging this first lets the cmux side repoint its ghostty submodule back to manaflow-ai/ghostty#main instead of rod's fork.

Test plan

  • zig build clean
  • Call ghostty_config_set_color_scheme from embedder before ghostty_config_finalize, confirm conditional theme = light:X,dark:Y resolves to the expected scheme
  • cmux PR #2710 green once pointer bumps to this merged SHA

Summary by cubic

Add ghostty_config_set_color_scheme C API to set the config’s color scheme before finalization so conditional themes resolve to the correct light/dark variant. Prevents wrong theme after config reload in embedders like cmux.

  • New Features
    • New API: ghostty_config_set_color_scheme(ghostty_config_t, ghostty_color_scheme_e); call before ghostty_config_finalize to set .light or .dark for conditional theme resolution. Invalid values are ignored with a warning; default remains .light if not set.

Summary by CodeRabbit

  • New Features
    • Added a new public API function to set color scheme preferences (light or dark) on configuration objects with input validation.