hex_color!() { /* proc-macro */ }
Expand description

Creates an iced::Color struct from a valid hex color code

Example usage:

use iced::widget::text;
use iced_hex_color::hex_color;

// To create a text widget with color #78cc23a6
let text_style = iced::theme::Text::Color(hex_color!(#78cc23a6));
let text_widget = text("Hello, world!").style(text_style);

In the above example, the macro will generate code similar to the following:

iced::Color::from_rgba8(120, 204, 35, 0.65)

The hex_color crate is used to parse the hex codes. See the HexColor::parse function for more information.