Struct turtle::color::Color [] [src]

pub struct Color {
    pub red: f64,
    pub green: f64,
    pub blue: f64,
    pub alpha: f64,
}

Type for representing a color.

See the module level documentation for more.

Fields

Value between 0.0 and 255.0

Value between 0.0 and 255.0

Value between 0.0 and 255.0

Value between 0.0 and 1.0

Methods

impl Color
[src]

[src]

Return a new color with all of the same values except with opacity (alpha) set to 1.0

use turtle::Color;
let color = Color {red: 43.0, green: 79.0, blue: 23.0, alpha: 0.5};
assert_eq!(color.alpha, 0.5);
let color2 = color.opaque();
assert_eq!(color.alpha, 0.5);
assert_eq!(color2.alpha, 1.0);

[src]

Return a new color with all of the same values except with opacity (alpha) set to 0.0

use turtle::Color;
let color = Color {red: 43.0, green: 79.0, blue: 23.0, alpha: 0.5};
assert_eq!(color.alpha, 0.5);
let color2 = color.transparent();
assert_eq!(color.alpha, 0.5);
assert_eq!(color2.alpha, 0.0);

Trait Implementations

impl Debug for Color
[src]

[src]

Formats the value using the given formatter.

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 Copy 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 Rand for Color
[src]

[src]

Generates a random instance of this type using the specified source of randomness. Read more

impl<'a> From<&'a str> for Color
[src]

[src]

Performs the conversion.