Macro rgb

Source
macro_rules! rgb {
    () => { ... };
    ($val:expr) => { ... };
    ($r:expr, $g:expr, $b:expr) => { ... };
}
Expand description

Utility macro for creating an RGB color.

ยงExamples

You can create a default (i.e., black) color by calling this macro without any arguments:

use rustvision::{rgb, color::Color};

let color = rgb!();
assert_eq!(color, Color { r: 0, g: 0, b: 0});

If you want to create a color with a certain gray value (i.e., all channels have the same value), you can do so by calling the macro with a single argument:

use rustvision::{rgb, color::Color};

let color = rgb!(42);
assert_eq!(color, Color { r: 42, g: 42, b: 42});

By calling the macro with three arguments, you create a simple color:

use rustvision::{rgb, color::Color};

let color = rgb!(42, 17, 129);
assert_eq!(color, Color { r: 42, g: 17, b: 129});