Struct libnotcurses_sys::c_api::ffi::ncpalette
source · #[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 PartialEq<ncpalette> for ncpalette
impl PartialEq<ncpalette> for ncpalette
source§impl PartialOrd<ncpalette> for ncpalette
impl PartialOrd<ncpalette> for ncpalette
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read more