#[repr(C)]pub struct ncpalette {
pub chans: [u32; 256],
}Expand description
Palette API. Some terminals only support 256 colors, but allow the full palette to be specified with arbitrary RGB colors. In all cases, it’s more performant to use indexed colors, since it’s much less data to write to the terminal. If you can limit yourself to 256 colors, that’s probably best.
Fields§
§chans: [u32; 256]RGB values as regular ol’ channels
Implementations§
Source§impl ncpalette
impl ncpalette
Sourcepub fn new<'a>(nc: &mut Nc) -> &'a mut Self
pub fn new<'a>(nc: &mut Nc) -> &'a mut Self
Returns a new NcPalette.
C style function: ncpalette_new().
Sourcepub fn free(&mut self)
pub fn free(&mut self)
Frees this NcPalette.
C style function: ncpalette_free().
Sourcepub fn use(&self, nc: &mut Nc) -> NcResult<()>
pub fn use(&self, nc: &mut Nc) -> NcResult<()>
Attempts to configure the terminal with this NcPalette.
C style function: ncpalette_use().
Sourcepub fn get(&self, index: impl Into<NcPaletteIndex>) -> NcRgb
pub fn get(&self, index: impl Into<NcPaletteIndex>) -> NcRgb
Returns the NcRgb value from an NcChannel
entry inside this NcPalette.
C style function: ncpalette_get().
Sourcepub fn set(&mut self, index: impl Into<NcPaletteIndex>, rgb: impl Into<NcRgb>)
pub fn set(&mut self, index: impl Into<NcPaletteIndex>, rgb: impl Into<NcRgb>)
Sets the NcRgb value of the NcChannel entry
inside this NcPalette.
C style function: ncpalette_set().
Trait Implementations§
Source§impl Ord for ncpalette
impl Ord for ncpalette
Source§impl PartialOrd for ncpalette
impl PartialOrd for ncpalette
impl Copy for ncpalette
impl Eq for ncpalette
impl StructuralPartialEq for ncpalette
Auto Trait Implementations§
impl Freeze for ncpalette
impl RefUnwindSafe for ncpalette
impl Send for ncpalette
impl Sync for ncpalette
impl Unpin for ncpalette
impl UnwindSafe for ncpalette
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more