Struct usvg::Color [−][src]
Expand description
Representation of the <color>
type.
Fields
red: u8
green: u8
blue: u8
Implementations
Constructs a new Color
from red
, green
and blue
values.
Trait Implementations
Parses Color
from StrSpan
.
Parsing is done according to spec:
color ::= "#" hexdigit hexdigit hexdigit (hexdigit hexdigit hexdigit)?
| "rgb(" wsp* integer comma integer comma integer wsp* ")"
| "rgb(" wsp* integer "%" comma integer "%" comma integer "%" wsp* ")"
| color-keyword
hexdigit ::= [0-9A-Fa-f]
comma ::= wsp* "," wsp*
* The SVG spec has an error. There should be number
,
not an integer
for percent values (details).
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
. - Allocates heap memory for case-insensitive named colors comparison.
Writes data to the Vec<u8>
buffer using specified WriteOptions
.
Writes data to the Vec<u8>
buffer using default WriteOptions
.
Returns an object that implements fmt::Display
using provided write options.
Auto Trait Implementations
impl RefUnwindSafe for Color
impl UnwindSafe for Color
Blanket Implementations
Mutably borrows from an owned value. Read more