Type Definition libnotcurses_sys::NcPalette

source ·
pub type NcPalette = ncpalette;
Expand description

An array of 256 NcChannels.

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

source

pub fn new<'a>(nc: &mut Nc) -> &'a mut Self

Returns a new NcPalette.

C style function: ncpalette_new().

source

pub fn free(&mut self)

Frees this NcPalette.

C style function: ncpalette_free().

source

pub fn use(&self, nc: &mut Nc) -> NcResult<()>

Attempts to configure the terminal with this NcPalette.

C style function: ncpalette_use().

source

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().

source

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().

source§

impl NcPalette

source

pub const SIZE: u32 = 256u32

The supported palette-indexed colors number is up to 8 bits.