Style class

An immutable bundle of a foreground/background colour and text attributes.

A null fg/bg means "terminal default". Style values are interned-free and cheap to compare, so the renderer can diff cell styles directly.

Constructors

Style({Color? fg, Color? bg, bool bold = false, bool italic = false, bool underline = false, bool reverse = false, bool dim = false})
const

Properties

bg Color?
final
bold bool
final
dim bool
final
fg Color?
final
hashCode int
The hash code for this object.
no setteroverride
italic bool
final
reverse bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sgr String
The full SGR escape that realises this style on the terminal, starting from a reset (\x1b[0;…m) so it is self-contained and never inherits a previous cell's attributes.
no setter
underline bool
final

Methods

copyWith({Color? fg, Color? bg, bool? bold, bool? italic, bool? underline, bool? reverse, bool? dim}) Style
Returns a copy of this style with the given fields overridden.
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.
override

Constants

none → const Style
The default (unstyled) style: terminal default colours, no attributes.