From 75b58293a1e19d31578fc5a5738fb2749104f2e8 Mon Sep 17 00:00:00 2001 From: Madeline Sparkles Date: Wed, 3 Jul 2024 15:48:25 +0800 Subject: [PATCH] add Text::with_style --- crates/yakui-widgets/src/widgets/text.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/yakui-widgets/src/widgets/text.rs b/crates/yakui-widgets/src/widgets/text.rs index 6b4e3fcb..aa8ffcc6 100644 --- a/crates/yakui-widgets/src/widgets/text.rs +++ b/crates/yakui-widgets/src/widgets/text.rs @@ -47,6 +47,14 @@ impl Text { } } + pub fn with_style>>(text: S, style: TextStyle) -> Self { + Self { + text: text.into(), + style, + padding: Pad::ZERO, + } + } + pub fn label(text: Cow<'static, str>) -> Self { Self { text,