use std::ops::BitOr;
use super::{chtype, COLOR_PAIR};
use crate::attributes::{Attribute, Attributes};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct ColorPair(pub u8);
impl From<ColorPair> for chtype {
fn from(color_pair: ColorPair) -> chtype {
COLOR_PAIR(chtype::from(color_pair.0))
}
}
impl BitOr<ColorPair> for Attributes {
type Output = Attributes;
fn bitor(mut self, rhs: ColorPair) -> Attributes {
self.set_color_pair(rhs);
self
}
}
impl BitOr<Attribute> for ColorPair {
type Output = Attributes;
fn bitor(self, rhs: Attribute) -> Attributes {
Attributes::new() | self | rhs
}
}
impl BitOr<ColorPair> for Attribute {
type Output = Attributes;
fn bitor(self, rhs: ColorPair) -> Attributes {
Attributes::new() | self | rhs
}
}