A collection of styling properties for text.
This is a simple storage class that holds information about how text should be styled. You can use it to specify the font, fill, size, and other properties of text in your rio app.
TextStyle(
*,
font: rio.Font | None = None,
fill: rio.SolidFill | rio.LinearGradientFill | rio.ImageFill | rio.Color | None = None,
font_size: float = 1.0,
italic: bool = False,
font_weight: Literal['normal', 'bold'] = 'normal',
underlined: bool = False,
strikethrough: bool = False,
all_caps: bool = False,
)
rio.Font | None
The Font
to use for the text. When set to None
, the default font
for the current context (heading or regular text, etc) will be used.
rio.SolidFill | rio.LinearGradientFill | rio.ImageFill | rio.Color | None
The fill (color, gradient, etc.) for the text.
float
The font size.
bool
Whether the text is italic or not.
Literal['normal', 'bold']
Whether the text is normal or bold.
bool
Whether the text is underlined or not.
bool
Whether the text should have a line through it.
bool
Whether the text is transformed to ALL CAPS or not.
rio.Font | None
The Font
to use for the text. When set to None
, the default font
for the current context (heading or regular text, etc) will be used.
rio.SolidFill | rio.LinearGradientFill | rio.ImageFill | rio.Color | None
The fill (color, gradient, etc.) for the text.
float
The font size.
bool
Whether the text is italic or not.
Literal['normal', 'bold']
Whether the text is normal or bold.
bool
Whether the text is underlined or not.
bool
Whether the text should have a line through it.
bool
Whether the text is transformed to ALL CAPS or not.
Returns an updated copy of the style.
This function allows you to create a new TextStyle
object with the
same properties as this one, except for the ones you specify.
def TextStyle.replace(
*,
font: rio.Font | None = None,
fill: rio.SolidFill | rio.LinearGradientFill | rio.ImageFill | rio.Color | None | rio.utils.NotGiven = <rio.utils.NotGiven object at 0x7f09024dc470>,
font_size: float | None = None,
italic: bool | None = None,
font_weight: Literal['normal', 'bold'] | None = None,
underlined: bool | None = None,
strikethrough: bool | None = None,
all_caps: bool | None = None,
) -> rio.TextStyle
rio.Font | None
The Font
to use for the text. When set to None
, the default font
for the current context (heading or regular text, etc) will be used.
rio.SolidFill | rio.LinearGradientFill | rio.ImageFill | rio.Color | None | rio.utils.NotGiven
The fill (color, gradient, etc.) for the text.
float | None
The font size.
bool | None
Whether the text is italic or not.
Literal['normal', 'bold'] | None
Whether the text is normal or bold.
bool | None
Whether the text is underlined or not.
bool | None
Whether the text should have a line through it.
bool | None
Whether the text is transformed to ALL CAPS or not.