ColorUtils class

Utility class for handling colored terminal output. Automatically detects if stdout/stderr are attached to a terminal and disables colors when output is piped to a file.

Constructors

ColorUtils.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

shouldUseColorsForStderr bool
Whether colors should be enabled for stderr
no setter
shouldUseColorsForStdout bool
Whether colors should be enabled for stdout
no setter

Static Methods

bold(String text) String
Convenience method for bold text on stdout
boldRedError(String text) String
Convenience method for bold red text on stderr
colorizeForStderr(String text, Colorize style(Colorize)) String
Creates a colorized string for stderr output. If stderr is not a terminal, returns the plain text without colors.
colorizeForStdout(String text, Colorize style(Colorize)) String
Creates a colorized string for stdout output. If stdout is not a terminal, returns the plain text without colors.
green(String text) String
Convenience method for green text on stdout
italic(String text) String
Convenience method for italic text on stdout
red(String text) String
Convenience method for red text on stdout
redError(String text) String
Convenience method for red text on stderr