pub struct Color {
pub red: u8,
pub green: u8,
pub blue: u8,
pub alpha: u8,
}
Expand description
Representation of the <color>
type.
Fields§
§red: u8
§green: u8
§blue: u8
§alpha: u8
Implementations§
Trait Implementations§
source§impl FromStr for Color
impl FromStr for Color
source§fn from_str(text: &str) -> Result<Self, Error>
fn from_str(text: &str) -> Result<Self, Error>
Parses CSS3 Color
from a string.
§Errors
- Returns error if a color has an invalid format.
- Returns error if
<color>
is followed by<icccolor>
. It’s not supported.
§Notes
- Any non-
hexdigit
bytes will be treated as0
. - The SVG 1.1 spec has an error.
There should be a
number
, not aninteger
for percent values (details). - It also supports 4 digits and 8 digits hex notation from the CSS Color Module Level 4.
impl Copy for Color
impl Eq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)