Struct svgparser::RgbColor [] [src]

pub struct RgbColor {
    pub red: u8,
    pub green: u8,
    pub blue: u8,
}

Representation of the <color> type.

Fields

Methods

impl RgbColor
[src]

Constructs a new RgbColor from red, green and blue values.

Parses RgbColor from the Stream.

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-keyword or rgb prefix are in in the lowercase. It's not supported.

  • Returns error if <color> is followed by <icccolor>. It's not supported.

Notes

  • Any non-hexdigit bytes will be treated as 0.

Trait Implementations

impl Copy for RgbColor
[src]

impl Clone for RgbColor
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for RgbColor
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Debug for RgbColor
[src]

Formats the value using the given formatter.