iced::widget

Macro rich_text

Source
macro_rules! rich_text {
    () => { ... };
    ($($x:expr),+ $(,)?) => { ... };
}
Expand description

Creates some Rich text with the given spans.

ยงExample

use iced::font;
use iced::widget::{rich_text, span};
use iced::{color, Font};

#[derive(Debug, Clone)]
enum Message {
    // ...
}

fn view(state: &State) -> Element<'_, Message> {
    rich_text![
        span("I am red!").color(color!(0xff0000)),
        " ",
        span("And I am bold!").font(Font { weight: font::Weight::Bold, ..Font::default() }),
    ]
    .size(20)
    .into()
}