Struct usvg::Color[][src]

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

Representation of the <color> type.

Fields

Methods

impl Color
[src]

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

Constructs a new Color set to black.

Constructs a new Color set to white.

Constructs a new Color set to gray.

Constructs a new Color set to red.

Constructs a new Color set to green.

Constructs a new Color set to blue.

Trait Implementations

impl From<Color> for AttributeValue
[src]

Performs the conversion.

impl WriteBuffer for Color
[src]

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.

impl FromSpan for Color
[src]

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 as 0.
  • Allocates heap memory for case-insensitive named colors comparison.

impl Display for Color
[src]

Formats the value using the given formatter. Read more

impl Clone for Color
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl FromStr for Color
[src]

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

impl Debug for Color
[src]

Formats the value using the given formatter. Read more

impl Copy for Color
[src]

impl PartialEq<Color> for Color
[src]

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

This method tests for !=.

Auto Trait Implementations

impl Send for Color

impl Sync for Color