Expand description
Terminal styling utilities for colored and formatted output.
This module provides convenience functions for styling text output to the terminal. Functions are prefixed to indicate their target stream:
e*functions (e.g.,ecyan,ebold) style text for stderrn*functions (e.g.,ncyan,ndim) style text for stdout
The styling functions automatically detect whether the target stream supports colors and will return plain text when colors are disabled.
§Examples
use clx::style::{ecyan, ebold, ered};
// Print colored text to stderr
eprintln!("{}", ecyan("Info:"));
eprintln!("{}", ered("Error:"));
eprintln!("{}", ebold("Important"));§Chaining Styles
The returned StyledObject can be further styled using method chaining:
use clx::style::ecyan;
// Combine cyan color with bold
eprintln!("{}", ecyan("Bold cyan").bold());Functions§
- eblack
- Styles the value with black color for stderr.
- eblue
- Styles the value with blue color for stderr.
- ebold
- Styles the value with bold formatting for stderr.
- ecyan
- Styles the value with cyan color for stderr.
- edim
- Styles the value with dim/faint formatting for stderr.
- egreen
- Styles the value with green color for stderr.
- emagenta
- Styles the value with magenta color for stderr.
- ered
- Styles the value with red color for stderr.
- ereset
- Returns the ANSI reset escape sequence for stderr, or an empty string if colors are disabled.
- estyle
- Creates a
StyledObjectconfigured for stderr output. - eunderline
- Styles the value with underline formatting for stderr.
- eyellow
- Styles the value with yellow color for stderr.
- ncyan
- Styles the value with cyan color for stdout.
- ndim
- Styles the value with dim/faint formatting for stdout.
- nred
- Styles the value with red color for stdout.
- nstyle
- Creates a
StyledObjectconfigured for stdout output. - nunderline
- Styles the value with underline formatting for stdout.
- nyellow
- Styles the value with yellow color for stdout.