Style class final
Composable ANSI style object inspired by Lip Gloss primitives.
All properties default to "unset" (null for optionals, false for booleans). Call inherit to fill in unset properties from a parent style.
Constructors
- Style({int? foreground256, int? background256, RgbColor? foregroundRgb, RgbColor? backgroundRgb, CompleteColor? foregroundComplete, CompleteColor? backgroundComplete, AdaptiveColor? adaptiveForeground, AdaptiveColor? adaptiveBackground, bool? isBold, bool? isDim, bool? isItalic, bool? isUnderline, UnderlineStyle? underlineStyle, RgbColor? underlineColor, bool? isStrikethrough, bool? isReverse, bool? isBlink, bool? isOverline, bool underlineSpaces = true, bool strikethroughSpaces = true, EdgeInsets padding = const EdgeInsets.all(0), EdgeInsets margin = const EdgeInsets.all(0), Border border = Border.none, RgbColor? borderForeground, RgbColor? borderBackground, RgbColor? marginBackground, String borderTitle = '', Align borderTitleAlignment = Align.left, int? width, int? height, int? maxWidth, int? maxHeight, Align align = Align.left, AlignVertical alignVertical = AlignVertical.top, bool inline = false, bool wordWrap = false, int tabWidth = 4, ColorProfile? profile, String transform(String)?, String? hyperlinkUrl, String hyperlinkParams = ''})
-
const
Properties
- adaptiveBackground → AdaptiveColor?
-
final
- adaptiveForeground → AdaptiveColor?
-
final
- align → Align
-
final
- alignVertical → AlignVertical
-
final
- background256 → int?
-
final
- backgroundComplete → CompleteColor?
-
A CompleteColor for the background.
final
- backgroundRgb → RgbColor?
-
final
- border → Border
-
final
- borderBackground → RgbColor?
-
Background color of the border characters.
final
- borderForeground → RgbColor?
-
Foreground (text) color of the border characters themselves.
final
- borderTitle → String
-
Optional title string embedded into the top border edge.
final
- borderTitleAlignment → Align
-
Horizontal alignment of borderTitle within the top edge.
final
- foreground256 → int?
-
final
- foregroundComplete → CompleteColor?
-
A CompleteColor lets you specify different color values for each
terminal color profile (trueColor, ansi256, ansi16). When set, takes
precedence over foregroundRgb and foreground256.
final
- foregroundRgb → RgbColor?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → int?
-
final
- hyperlinkParams → String
-
OSC 8 parameter field, commonly an
id=...value.final - hyperlinkUrl → String?
-
OSC 8 hyperlink target. An empty or null target emits no hyperlink.
final
- inline → bool
-
final
- isBlink → bool?
-
SGR 5 — slow blink.
null= unset (inheritable).final - isBold → bool?
-
SGR 1 — bold / increased intensity.
null= unset (inheritable).final - isDim → bool?
-
SGR 2 — faint / decreased intensity.
null= unset (inheritable).final - isItalic → bool?
-
SGR 3 — italic.
null= unset (inheritable).final - isOverline → bool?
-
SGR 53 — overline.
null= unset (inheritable).final - isReverse → bool?
-
SGR 7 — reverse video (swap foreground and background).
null= unset.final - isStrikethrough → bool?
-
SGR 9 — crossed-out / strikethrough.
null= unset (inheritable).final - isUnderline → bool?
-
SGR 4 — underline.
null= unset (inheritable).final - margin → EdgeInsets
-
final
- marginBackground → RgbColor?
-
Optional background color applied to the margin cells (the empty space
outside the border). When
null, margin cells are plain spaces.final - maxHeight → int?
-
final
- maxWidth → int?
-
final
- padding → EdgeInsets
-
final
- profile → ColorProfile?
-
The colour profile for this style. When null, Style.defaultProfile
applies.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strikethroughSpaces → bool
-
Whether spaces inside struck-through text are also struck through (default true).
final
- tabWidth → int
-
Number of spaces used to expand tab characters (
\t) during rendering. Defaults to 4. Set to 0 to pass tabs through unmodified.final - transform → String Function(String)?
-
Optional post-processing function applied to the final rendered string
(after layout, before returning). Useful for custom transforms.
final
- underlineColor → RgbColor?
-
SGR 58 true-color underline color.
final
- underlineSpaces → bool
-
Whether spaces inside underlined text are also underlined (default true).
final
- underlineStyle → UnderlineStyle?
-
Rich underline form. When set, takes precedence over isUnderline.
final
- width → int?
-
final
- wordWrap → bool
-
When
true, long lines are soft-wrapped at word boundaries to fit within width / maxWidth instead of being truncated.final
Methods
-
backgroundColor256(
int value) → Style -
backgroundColorRgb(
int r, int g, int b) → Style -
blink(
[bool value = true]) → Style -
bold(
[bool value = true]) → Style -
copyWith(
{int? foreground256, int? background256, RgbColor? foregroundRgb, RgbColor? backgroundRgb, CompleteColor? foregroundComplete, CompleteColor? backgroundComplete, AdaptiveColor? adaptiveForeground, AdaptiveColor? adaptiveBackground, bool? isBold, bool? isDim, bool? isItalic, bool? isUnderline, UnderlineStyle? underlineStyle, RgbColor? underlineColor, bool? isStrikethrough, bool? isReverse, bool? isBlink, bool? isOverline, bool? underlineSpaces, bool? strikethroughSpaces, EdgeInsets? padding, EdgeInsets? margin, Border? border, RgbColor? borderForeground, RgbColor? borderBackground, RgbColor? marginBackground, String? borderTitle, Align? borderTitleAlignment, int? width, int? height, int? maxWidth, int? maxHeight, Align? align, AlignVertical? alignVertical, bool? inline, bool? wordWrap, int? tabWidth, ColorProfile? profile, String transform(String)?, String? hyperlinkUrl, String? hyperlinkParams}) → Style -
dim(
[bool value = true]) → Style -
foregroundColor256(
int value) → Style -
foregroundColorRgb(
int r, int g, int b) → Style -
inherit(
Style parent) → Style -
Inherit unset properties from
parent. -
italic(
[bool value = true]) → Style -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overline(
[bool value = true]) → Style -
render(
String value) → String -
Render
valuewith all style attributes applied. -
reverse(
[bool value = true]) → Style -
strikethrough(
[bool value = true]) → Style -
toString(
) → String -
A string representation of this object.
inherited
-
underline(
[bool value = true]) → Style -
unsetBlink(
) → Style -
unsetBold(
) → Style -
unsetDim(
) → Style -
unsetItalic(
) → Style -
unsetOverline(
) → Style -
unsetReverse(
) → Style -
unsetStrikethrough(
) → Style -
unsetUnderline(
) → Style -
withAdaptiveBackground(
AdaptiveColor value) → Style -
withAdaptiveForeground(
AdaptiveColor value) → Style -
withAlign(
Align value) → Style -
withAlignVertical(
AlignVertical value) → Style -
withBackgroundComplete(
CompleteColor c) → Style -
withBorder(
Border value) → Style -
withBorderBackground(
RgbColor value) → Style -
withBorderForeground(
RgbColor value) → Style -
withBorderSides(
{bool? showTop, bool? showRight, bool? showBottom, bool? showLeft}) → Style - Convenience: copy the current border style with per-side visibility flags.
-
withBorderTitle(
String title, {Align alignment = Align.left}) → Style -
withForegroundComplete(
CompleteColor c) → Style -
withHeight(
int? value) → Style -
withHyperlink(
String url, {String params = ''}) → Style -
withInline(
bool value) → Style -
withMargin(
EdgeInsets value) → Style -
withMarginBackground(
RgbColor value) → Style -
withMaxHeight(
int? value) → Style -
withMaxWidth(
int? value) → Style -
withPadding(
EdgeInsets value) → Style -
withProfile(
ColorProfile? value) → Style -
withStrikethroughSpaces(
bool value) → Style -
withTabWidth(
int value) → Style -
withTransform(
String fn(String)?) → Style -
withUnderlineColor(
RgbColor value) → Style -
withUnderlineSpaces(
bool value) → Style -
withUnderlineStyle(
UnderlineStyle value) → Style -
withWidth(
int? value) → Style -
withWordWrap(
bool value) → Style
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- defaultProfile ↔ ColorProfile
-
The ColorProfile every style uses when its own profile is null.
getter/setter pair
- hasDarkBackground ↔ bool
-
Whether the terminal background is dark, for AdaptiveColor in styles
with no background of their own.
getter/setter pair