Type Definition libnotcurses_sys::NcPalette
source · pub type NcPalette = ncpalette;
Expand description
An array of 256 NcChannel
s.
See also NcPaletteIndex
.
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.
type in C: ncncpalette (struct)
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().