use crate::derives::*;
use app_units::Au;
use euclid::default::Size2D;
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
#[repr(u8)]
#[allow(missing_docs)]
pub enum Orientation {
Portrait,
Landscape,
}
impl Orientation {
pub fn eval(size: Size2D<Au>, value: Option<Self>) -> bool {
let query_orientation = match value {
Some(v) => v,
None => return true,
};
let is_landscape = size.width > size.height;
match query_orientation {
Self::Landscape => is_landscape,
Self::Portrait => !is_landscape,
}
}
}
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, ToCss)]
#[repr(u8)]
#[allow(missing_docs)]
pub enum PrefersColorScheme {
Light,
Dark,
}