diff options
author | 2024-07-11 05:11:34 +0200 | |
---|---|---|
committer | 2024-07-11 05:11:34 +0200 | |
commit | 3c55e076688fd7453e5feb53fccf8139076af584 (patch) | |
tree | 8996c3fb52040b9a9e75ca2cd9e52d43e5895d95 /core | |
parent | aaab9865c49025d49071d748a92453a457668ef1 (diff) | |
parent | 03e8078f4266e73f5b0fe5bc18c8853f947417bd (diff) | |
download | iced-3c55e076688fd7453e5feb53fccf8139076af584.tar.gz iced-3c55e076688fd7453e5feb53fccf8139076af584.tar.bz2 iced-3c55e076688fd7453e5feb53fccf8139076af584.zip |
Merge pull request #2500 from iced-rs/builtin-text-styles
Add some built-in text styles for each `Palette` color
Diffstat (limited to 'core')
-rw-r--r-- | core/src/widget/text.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/src/widget/text.rs b/core/src/widget/text.rs index f1f0b345..081407e5 100644 --- a/core/src/widget/text.rs +++ b/core/src/widget/text.rs @@ -367,6 +367,34 @@ impl Catalog for Theme { } } +/// Text conveying some important information, like an action. +pub fn primary(theme: &Theme) -> Style { + Style { + color: Some(theme.palette().primary), + } +} + +/// Text conveying some secondary information, like a footnote. +pub fn secondary(theme: &Theme) -> Style { + Style { + color: Some(theme.extended_palette().secondary.strong.color), + } +} + +/// Text conveying some positive information, like a successful event. +pub fn success(theme: &Theme) -> Style { + Style { + color: Some(theme.palette().success), + } +} + +/// Text conveying some negative information, like an error. +pub fn danger(theme: &Theme) -> Style { + Style { + color: Some(theme.palette().danger), + } +} + /// A fragment of [`Text`]. /// /// This is just an alias to a string that may be either |