vt: add color data getters to render state

Add individual color data kinds to GhosttyRenderStateData so callers
can query background, foreground, cursor color, cursor-color presence,
and the full 256-color palette through ghostty_render_state_get()
without using the sized-struct colors API.

COLOR_CURSOR returns GHOSTTY_INVALID_VALUE when no explicit cursor
color is set; callers can check COLOR_CURSOR_HAS_VALUE first.
This commit is contained in:
Mitchell Hashimoto
2026-03-20 08:57:16 -07:00
parent 6ae17a02af
commit 60ea2d76d4
2 changed files with 37 additions and 0 deletions

View File

@@ -126,6 +126,23 @@ typedef enum {
* It is unsafe to use row data after updating the render state.
* */
GHOSTTY_RENDER_STATE_DATA_ROW_ITERATOR = 4,
/** Default/current background color (GhosttyColorRgb). */
GHOSTTY_RENDER_STATE_DATA_COLOR_BACKGROUND = 5,
/** Default/current foreground color (GhosttyColorRgb). */
GHOSTTY_RENDER_STATE_DATA_COLOR_FOREGROUND = 6,
/** Cursor color when explicitly set by terminal state (GhosttyColorRgb).
* Returns GHOSTTY_INVALID_VALUE if no explicit cursor color is set;
* use COLOR_CURSOR_HAS_VALUE to check first. */
GHOSTTY_RENDER_STATE_DATA_COLOR_CURSOR = 7,
/** Whether an explicit cursor color is set (bool). */
GHOSTTY_RENDER_STATE_DATA_COLOR_CURSOR_HAS_VALUE = 8,
/** The active 256-color palette (GhosttyColorRgb[256]). */
GHOSTTY_RENDER_STATE_DATA_COLOR_PALETTE = 9,
} GhosttyRenderStateData;
/**