chromashift/
channels.rs

1/// Trait for extracting the alpha channel of a color.
2pub trait ToAlpha: Sized {
3	/// Returns a number between 0.0 (fully transparent) to 100.0 (fully opaque).
4	fn to_alpha(&self) -> f32;
5
6	/// Returns true if the alpha of this colour is 100.0
7	fn fully_opaque(&self) -> bool {
8		self.to_alpha() == 100.0
9	}
10
11	/// Returns true if the alpha of this colour is 0.0
12	fn fully_transparent(&self) -> bool {
13		self.to_alpha() == 0.0
14	}
15}