diff options
| author | akbash <akbash@herdr.dev> | 2026-07-24 01:28:35 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-24 01:28:35 +0300 |
| commit | 503613c8ecbea752a234daf30cb0ad5a8bf93e4e (patch) | |
| tree | 34b71e4c7055244ed191c043457c572e3ccfc935 /src/ghostty | |
| parent | 58ad2c6438cf25cdf7e95528c7114d3bf12626d2 (diff) | |
fix: inherit host palette in pane queries (#1759)
refs #1752
Co-authored-by: Ogulcan Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/ghostty')
| -rw-r--r-- | src/ghostty/mod.rs | 22 |
1 files changed, 22 insertions, 0 deletions
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<ffi::GhosttyColorRgb> 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, |
