| 1 |
use crate::palette; |
| 2 |
use ratatui::style::{Modifier, Style}; |
| 3 |
use ratatui::text::Span; |
| 4 |
|
| 5 |
pub fn fg(s: impl Into<String>) -> Span<'static> { |
| 6 |
Span::styled(s.into(), Style::default().fg(palette::FG)) |
| 7 |
} |
| 8 |
|
| 9 |
pub fn dim(s: impl Into<String>) -> Span<'static> { |
| 10 |
Span::styled(s.into(), Style::default().fg(palette::DIM)) |
| 11 |
} |
| 12 |
|
| 13 |
pub fn bold(s: impl Into<String>) -> Span<'static> { |
| 14 |
Span::styled( |
| 15 |
s.into(), |
| 16 |
Style::default().fg(palette::FG).add_modifier(Modifier::BOLD), |
| 17 |
) |
| 18 |
} |
| 19 |
|
| 20 |
pub fn ok(s: impl Into<String>) -> Span<'static> { |
| 21 |
Span::styled(s.into(), Style::default().fg(palette::STATE_OK)) |
| 22 |
} |
| 23 |
|
| 24 |
pub fn warn(s: impl Into<String>) -> Span<'static> { |
| 25 |
Span::styled(s.into(), Style::default().fg(palette::STATE_WARN)) |
| 26 |
} |
| 27 |
|
| 28 |
pub fn fault(s: impl Into<String>) -> Span<'static> { |
| 29 |
Span::styled(s.into(), Style::default().fg(palette::STATE_FAULT)) |
| 30 |
} |
| 31 |
|
| 32 |
pub fn inactive(s: impl Into<String>) -> Span<'static> { |
| 33 |
dim(s) |
| 34 |
} |
| 35 |
|