Skip to main content

format_ansi_text

Function format_ansi_text 

Source
pub fn format_ansi_text(
    text: &str,
    bold: bool,
    italic: bool,
    underline: bool,
    fg_color: Option<&TermColor>,
    bg_color: Option<&TermColor>,
) -> String
Expand description

Format text with ANSI styling

This is a convenience function to easily add common ANSI styles

§Arguments

  • text - The text to format
  • bold - Whether to make the text bold
  • italic - Whether to make the text italic
  • underline - Whether to underline the text
  • fg_color - Optional foreground color
  • bg_color - Optional background color

§Returns

The formatted text with ANSI codes