pub struct Rgba<T>(pub T);
Expand description
Parses an RGBA Color.
§Schema
- Bracketed numbers:
[0.3, 0.72, 0.98]
,[124, 54, 87, 255]
- Repeat syntax:
[0.3; 3]
,[0.7; 4]
- Hex strings:
"AABBCC"
,"AABBCCFF"
,"#AABBCC"
,"#AABBCCFF"
- Hex number literals:
0xAABBCC
,0xAABBCCFF
- CSS color names:
Red
,Blue
- TailwindCSS color names:
Red100
,Sky400
§Conversion
Ints are in 0..=255
, floats are in 0.0..=1.0
.
When parsing to u8, if any value is a float, the color is considered in range 0.0..=1.0
When parsing to float, if all values are ints and any of them is>= 2
, the color is considered to be in range 0.0..=255.0
.
Tuple Fields§
§0: T
Trait Implementations§
Source§impl FromMacro for Rgba<[f32; 4]>
impl FromMacro for Rgba<[f32; 4]>
Source§impl FromMacro for Rgba<[u8; 4]>
impl FromMacro for Rgba<[u8; 4]>
impl<T: Eq> Eq for Rgba<T>
impl<T> StructuralPartialEq for Rgba<T>
Auto Trait Implementations§
impl<T> Freeze for Rgba<T>where
T: Freeze,
impl<T> RefUnwindSafe for Rgba<T>where
T: RefUnwindSafe,
impl<T> Send for Rgba<T>where
T: Send,
impl<T> Sync for Rgba<T>where
T: Sync,
impl<T> Unpin for Rgba<T>where
T: Unpin,
impl<T> UnwindSafe for Rgba<T>where
T: UnwindSafe,
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