FontStyle class Styling
Represents a text font style in ANSI terminal sequences.
Provides predefined font styles such as bold, italic, underline, and strikethrough, identified by their ANSI style codes.
Properties
Responsibilities
- Map ANSI style codes to named font styles.
- Provide a way to get a font style from its ANSI code.
Example
final boldStyle = FontStyle.bold;
print(boldStyle.code); // Outputs: 1
print(boldStyle.name); // Outputs: "bold"
final underlineStyle = FontStyle.fromCode(4);
print(underlineStyle.name); // Outputs: "underline"
See Also
- ANSI escape codes for font styling.
- AnsiColorType - For styling text with color
Constructors
- FontStyle.fromCode(int code)
-
Returns the FontStyle matching the given ANSI
code
.factory
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- bold → const FontStyle
- Bold font style (ANSI code 1).
- italic → const FontStyle
- Italic font style (ANSI code 3).
- strikethrough → const FontStyle
- Strikethrough font style (ANSI code 9).
- underline → const FontStyle
- Underline font style (ANSI code 4).
-
values
→ const List<
FontStyle> - List of all predefined font styles.