style: Add support for disabled document colors.

This commit is contained in:
Cameron McCormack 2017-05-30 14:33:33 +08:00
parent 9e89b0a229
commit c768169149
15 changed files with 103 additions and 13 deletions

View file

@ -178,6 +178,15 @@ impl CSSColor {
authored: None,
})
}
/// Returns false if the color is completely transparent, and
/// true otherwise.
pub fn is_non_transparent(&self) -> bool {
match self.parsed {
Color::RGBA(rgba) if rgba.alpha == 0 => false,
_ => true,
}
}
}
no_viewport_percentage!(CSSColor);