From 503613c8ecbea752a234daf30cb0ad5a8bf93e4e Mon Sep 17 00:00:00 2001 From: akbash Date: Fri, 24 Jul 2026 01:28:35 +0300 Subject: fix: inherit host palette in pane queries (#1759) refs #1752 Co-authored-by: Ogulcan Celik --- src/ghostty/mod.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/ghostty/mod.rs') diff --git a/src/ghostty/mod.rs b/src/ghostty/mod.rs index 3a3a0791..1a2a8cbb 100644 --- a/src/ghostty/mod.rs +++ b/src/ghostty/mod.rs @@ -337,6 +337,12 @@ impl From for RgbColor { } } +pub fn default_palette() -> [RgbColor; 256] { + let mut palette = [ffi::GhosttyColorRgb::default(); 256]; + unsafe { ffi::ghostty_color_palette_default(palette.as_mut_ptr()) }; + palette.map(Into::into) +} + #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum CellColor { Palette(u8), @@ -770,6 +776,22 @@ impl Terminal { } } + pub fn set_default_palette(&mut self, palette: &[RgbColor; 256]) -> Result<(), Error> { + let palette = palette.map(|color| ffi::GhosttyColorRgb { + r: color.r, + g: color.g, + b: color.b, + }); + unsafe { + ffi::ghostty_terminal_set( + self.raw, + ffi::GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_COLOR_PALETTE, + palette.as_ptr().cast(), + ) + .into_result() + } + } + pub fn resize( &mut self, cols: u16, -- cgit v1.2.3