TextStyle class

An immutable style describing how to format and paint text.

This is a simplified version of Flutter's TextStyle for terminal use. It follows Flutter's naming conventions to make it familiar for Flutter developers.

Constructors

TextStyle({Color? color, Color? backgroundColor, FontWeight? fontWeight, FontStyle? fontStyle, TextDecoration? decoration, bool reverse = false})
Creates a text style.
const

Properties

backgroundColor Color?
The color to use as the background for the text.
final
color Color?
The color to use when painting the text.
final
decoration TextDecoration?
The decorations to paint near the text (e.g., underline).
final
fontStyle FontStyle?
The typeface variant to use when drawing the letters.
final
fontWeight FontWeight?
The typeface thickness to use when painting the text.
final
hashCode int
The hash code for this object.
no setteroverride
reverse bool
Whether to reverse the foreground and background colors.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({Color? color, Color? backgroundColor, FontWeight? fontWeight, FontStyle? fontStyle, TextDecoration? decoration, bool? reverse}) TextStyle
Creates a copy of this text style but with the given fields replaced.
merge(TextStyle? other) TextStyle
Merge this style with another, with the other style taking precedence.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toAnsi() String
Converts this text style to ANSI escape codes.
toString() String
A string representation of this object.
override

Operators

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

Constants

reset → const String
ANSI reset code to clear all formatting.