iced_core

Macro color

source
macro_rules! color {
    ($r:expr, $g:expr, $b:expr) => { ... };
    ($r:expr, $g:expr, $b:expr, $a:expr) => { ... };
    ($hex:expr) => { ... };
    ($hex:expr, $a:expr) => { ... };
}
Expand description

Creates a Color with shorter and cleaner syntax.

ยงExamples

assert_eq!(color!(0, 0, 0), Color::BLACK);
assert_eq!(color!(0, 0, 0, 0.0), Color::TRANSPARENT);
assert_eq!(color!(0xffffff), Color::from_rgb(1.0, 1.0, 1.0));
assert_eq!(color!(0xffffff, 0.), Color::from_rgba(1.0, 1.0, 1.0, 0.0));
assert_eq!(color!(0x0000ff), Color::from_rgba(0.0, 0.0, 1.0, 1.0));