pub fn style(
text: &str,
fg: Option<Color>,
bg: Option<Color>,
bold: bool,
dim: bool,
underline: bool,
overline: bool,
italic: bool,
blink: bool,
strikethrough: bool,
reset: bool,
) -> StringExpand description
Style text with ANSI escape codes.
Creates a styled string with the specified formatting. If the terminal doesn’t support colors or formatting is disabled, returns the text unchanged.
§Arguments
text- The text to stylefg- Foreground colorbg- Background colorbold- Bold textdim- Dim (faint) textunderline- Underlined textoverline- Overlined text (not widely supported)italic- Italic textblink- Blinking textstrikethrough- Strikethrough textreset- Whether to reset all styles at the end
§Returns
The styled string with ANSI escape codes.