pub fn terminal_palette() -> Option<[(u8, u8, u8); 256]> {
imp::terminal_palette()
}
#[derive(Clone, Copy)]
pub struct DefaultColors {
#[allow(dead_code)]
fg: (u8, u8, u8),
bg: (u8, u8, u8),
}
pub fn default_colors() -> Option<&'static DefaultColors> {
imp::default_colors()
}
#[allow(dead_code)]
pub fn default_fg() -> Option<(u8, u8, u8)> {
default_colors().map(|c| c.fg)
}
pub fn default_bg() -> Option<(u8, u8, u8)> {
default_colors().map(|c| c.bg)
}
#[cfg(all(unix, not(test)))]
mod imp {
use super::DefaultColors;
use std::mem::MaybeUninit;
use std::os::fd::RawFd;
use std::sync::OnceLock;
pub(super) fn terminal_palette() -> Option<[(u8, u8, u8); 256]> {
static CACHE: OnceLock