Struct libnotcurses_sys::c_api::ncpalette
source · [−]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
sourceimpl 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 get_rgb(&self, index: impl Into<NcPaletteIndex>) -> NcRgb
pub fn get_rgb(&self, index: impl Into<NcPaletteIndex>) -> NcRgb
Returns the individual RGB color components from an
NcChannel entry inside this NcPalette.
C style function: ncpalette_get_rgb8().
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().
sourcepub fn set_rgb(
palette: &mut NcPalette,
index: impl Into<NcPaletteIndex>,
rgb: impl Into<NcRgb>
)
pub fn set_rgb(
palette: &mut NcPalette,
index: impl Into<NcPaletteIndex>,
rgb: impl Into<NcRgb>
)
Sets the individual RGB components of an NcChannel
entry inside an NcPalette.
C style function: ncpalette_set_rgb8().
Trait Implementations
sourceimpl Ord for ncpalette
impl Ord for ncpalette
sourceimpl PartialOrd<ncpalette> for ncpalette
impl PartialOrd<ncpalette> for ncpalette
sourcefn partial_cmp(&self, other: &ncpalette) -> Option<Ordering>
fn partial_cmp(&self, other: &ncpalette) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn 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
impl Copy for ncpalette
impl Eq for ncpalette
impl StructuralEq for ncpalette
impl StructuralPartialEq for ncpalette
Auto Trait Implementations
impl RefUnwindSafe for ncpalette
impl Send for ncpalette
impl Sync for ncpalette
impl Unpin for ncpalette
impl UnwindSafe for ncpalette
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more