aboutsummaryrefslogtreecommitdiff
path: root/src/ghostty
diff options
context:
space:
mode:
Diffstat (limited to 'src/ghostty')
-rw-r--r--src/ghostty/mod.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ghostty/mod.rs b/src/ghostty/mod.rs
index 685c0735..ef67b86f 100644
--- a/src/ghostty/mod.rs
+++ b/src/ghostty/mod.rs
@@ -865,6 +865,21 @@ impl Terminal {
}
}
+ pub fn default_palette(&self) -> Result<[RgbColor; 256], Error> {
+ let mut out = [ffi::GhosttyColorRgb::default(); 256];
+ // SAFETY: self.raw is a live terminal handle, and out is exactly the
+ // 256-entry array this data kind writes.
+ unsafe {
+ ffi::ghostty_terminal_get(
+ self.raw,
+ ffi::GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_COLOR_PALETTE_DEFAULT,
+ out.as_mut_ptr().cast(),
+ )
+ .into_result()?;
+ }
+ Ok(out.map(Into::into))
+ }
+
pub fn resize(
&mut self,
cols: u16,