pub struct ConsoleTheme { /* private fields */ }Expand description
Color theme for console error output.
The fields are &'static str ANSI escapes — no allocation per
construction, and const-constructible for the three preset
constructors (ConsoleTheme::with_colors, ConsoleTheme::plain).
Implementations§
Source§impl ConsoleTheme
impl ConsoleTheme
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new theme with default colors. Auto-detects terminal
color support; falls back to Self::plain if stderr is not
a TTY, TERM=dumb, or NO_COLOR is set.
Sourcepub const fn with_colors() -> Self
pub const fn with_colors() -> Self
Create a new theme with colors forced on, regardless of terminal detection.
Sourcepub const fn plain() -> Self
pub const fn plain() -> Self
Create a new theme with no colors (plain text). Useful for piping output to a file or non-TTY consumer.
Sourcepub fn format_error<E: ForgeError>(&self, err: &E) -> String
pub fn format_error<E: ForgeError>(&self, err: &E) -> String
Format an error display in a structured way.
Writes the caption, the error’s Display output, the
retryability marker, and the optional source chain into a
single String buffer. Allocates exactly once.