Style class final
How text looks: colors, attributes and a hyperlink. A field left unset (null, or an attribute in neither attrs nor attrsOff) takes its value from the style this one is merged onto (merge); when the text is painted, an unset color is that of the cell painted over and an unset attribute is off (pen).
Bold text in yellow, and a style that turns bold off whatever it is merged onto:
const warning = Style(fg: Color.yellow, attrs: Attr.bold);
const plain = Style(attrsOff: Attr.bold);
assert(warning.merge(plain).attrs == 0);
See also:
- Span and StringStyles, for text in a style:
'x'.bold. - Theme, the styles of an app by what they are for.
- Annotations
-
- @immutable
Constructors
Properties
- attrs → int
-
Attr bits turned on; the underline bits hold a kind of underline.
final
- attrsOff → int
-
Attr bits turned off.
final
- bg → Color?
-
Background color; null keeps the background of the cell painted over.
final
- bgAlpha → int
-
Opacity of bg (255 opaque, 0 invisible): it blends over the
background of the cell painted over.
final
- fg → Color?
-
Text color; null shows the text color of the cell painted over.
final
- fgAlpha → int
-
Opacity of fg (255 opaque): the text blends over the background it
ends up on.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- link → String?
-
Hyperlink target (OSC 8); empty for none.
final
- pen → Pen
-
The core's pen for this style. Unset colors stay null, so they are
those of the cell painted over; the attributes, underline color and
link replace those of the cell, so unset ones are off.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- underlineColor → Color?
-
Color of the underline; Color.defaultColor draws it in the text
color.
final
Methods
-
merge(
Style other) → Style -
This style with the fields
othersets taken fromother: a color together with its alpha, an underline as a whole. This style itself whereothersets nothing, andotheritself where this one sets nothing: a merge allocates only a style that differs from both. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
penIn(
StyleTable table) → int -
The id of pen in
table: registered on first use, the same id for every equal style after that. A style looked up before intable, or one equal to it, costs no Pen: the ids are kept by style for each table (a table never forgets a pen). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
Whether
otheris a style of equal fields.override