Function ncursesw::attr_off[][src]

pub fn attr_off<A, T>(attrs: A) -> Result<(), NCurseswError> where
    A: AttributesType<T>,
    T: ColorAttributeTypes
Expand description

Switch off the given attributes on the standard screen.

Example

extern crate ncursesw;
extern crate ascii;

use ascii::*;
use ncursesw::*;
use ncursesw::normal::*;

start_color()?;

use_default_colors()?;

let color_pair0 = ColorPair::default();
let color_pair1 = ColorPair::new(1, Colors::new(Color::Dark(BaseColor::Yellow), Color::Dark(BaseColor::Blue)))?;

let attrs0 = Attribute::Dim | color_pair0;
let attrs1 = Attribute::Bold | Attribute::Dim | color_pair1;

let ascii_char = AsciiChar::A;
let chtype_char = ChtypeChar::new(ascii_char);

attr_set(attrs1, color_pair1)?;
addch(chtype_char | attrs0)?;

match attr_get()? {
    AttributesColorPairSet::Normal(s) => {
        assert!(s.attributes().is_bold());
        assert!(s.attributes().is_dim());
        assert!(s.color_pair() == color_pair1);
    },
    AttributesColorPairSet::Extend(_) => {
        panic!("not a extended attributes/color pair!");
    }
}

attr_off(Attributes::default() | Attribute::Dim)?;

match attr_get()? {
    AttributesColorPairSet::Normal(s) => {
        assert!(s.attributes().is_bold());
        assert!(!s.attributes().is_dim());
        assert!(s.color_pair() == color_pair1);
    },
    AttributesColorPairSet::Extend(_) => {
        panic!("not a extended attributes/color pair!");
    }
}