pub struct RichText { /* private fields */ }
Expand description

Text and optional style choices for it.

The style choices (font, color) are applied to the entire text. For more detailed control, use crate::text::LayoutJob instead.

A RichText can be used in most widgets and helper functions, e.g. Ui::label and Ui::button.

Example

use egui::{RichText, Color32};

RichText::new("Plain");
RichText::new("colored").color(Color32::RED);
RichText::new("Large and underlined").size(20.0).underline();

Implementations

Select the font size (in points). This overrides the value from Self::text_style.

Select the font family.

This overrides the value from Self::text_style.

Only the families available in crate::FontDefinitions::families may be used.

Select the font and size. This overrides the value from Self::text_style.

Override the TextStyle.

Set the TextStyle unless it has already been set

Monospace label with different background color.

Extra strong text (stronger color).

Extra weak text (fainter color).

Draw a line under the text.

If you want to control the line color, use LayoutJob instead.

Draw a line through the text, crossing it out.

If you want to control the strikethrough line color, use LayoutJob instead.

Tilt the characters to the right.

Smaller text.

For e.g. exponents.

Align text to top. Only applicable together with Self::small().

Fill-color behind the text.

Override text color.

Read the font height of the selected text style.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.