Struct kpdb::Color [] [src]

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

A structure representing a color (RGB).

Fields

Red part of the color.

Green part of the color.

Blue part of the color.

Methods

impl Color
[src]

[src]

Attempts to create a color from an hex string.

Errors

This function will return an error when the hex string is not a valid color.

Examples

use kpdb::Color;

let color = try!(Color::from_hex_string("#abcdef"));

[src]

Gets the hex string representation of the supplied color.

Examples

use kpdb::Color;

let color = Color { red: 171, green: 205, blue: 239 };
let hex = color.to_hex_string();

Trait Implementations

impl Clone for Color
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Color
[src]

[src]

Formats the value using the given formatter.

impl Eq for Color
[src]

impl PartialEq for Color
[src]

[src]

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

[src]

This method tests for !=.

impl PartialOrd for Color
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for Color
[src]

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more