ColorToken class

Represents a string value with color information.

Can be used to store the text and color information for a single token.

Use ColorToken.formatted to get the ANSI formatted text, which you can output to the console.

Constructors

ColorToken({required String text, required int fgColor, required int bgColor, bool xterm256 = false, Set<TermStyle>? styles})
ColorToken.defaultColor(String text)
Create a token with default color and the given text.
factory
ColorToken.empty()
Create an empty token.
factory
ColorToken.emptyReset()
Create an empty token with a reset style.
factory

Properties

bgColor int
The background color code.
getter/setter pair
bold bool
Whether the text is bold.
no setter
conceal bool
Whether the text is concealed.
no setter
dim bool
Whether the text is dim.
no setter
fgColor int
The foreground color code.
getter/setter pair
formatted String
Get the formatted text as ANSI formatted text.
no setter
hasBgColor bool
Whether the text has a background color.
no setter
hasFgColor bool
Whether the text has a foreground color.
no setter
hashCode int
The hash code for this object.
no setteroverride
inverse bool
Whether the text's colors should be inverse.
no setter
isEmpty bool
Returns true if the text is empty.
no setter
isNotEmpty bool
Returns true if the text is not empty.
no setter
italic bool
Whether the text is italic.
no setter
Whether the text is rapid blinking.
no setter
reset bool
Whether the text is reset at the end.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
Whether the text is slow blinking.
no setter
strikeout bool
Whether the text is struck out.
no setter
styles Set<TermStyle>
The styles applied to the text.
getter/setter pair
text String
The raw, uncoded text.
getter/setter pair
underline bool
Whether the text is underlined.
no setter
xterm256 bool
Whether the text is an xterm256 color code. Otherwise, it is an ANSI color code.
getter/setter pair

Methods

debugProperties() List<String>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setStyle(int code) → void
Set the style based on the given code.
toString() String
A string representation of this object.
override

Operators

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