Table of Contents

Struct Style

Namespace
MiniTui
Assembly
MiniTui.dll

A patch of cell attributes. Drawing with a style changes only what the style specifies: a null Fg or Bg keeps the cell's existing color.

public readonly record struct Style : IEquatable<Style>
Implements
Inherited Members

Constructors

Style(Color?, Color?, Modifiers, Modifiers)

A patch of cell attributes. Drawing with a style changes only what the style specifies: a null Fg or Bg keeps the cell's existing color.

public Style(Color? Fg = null, Color? Bg = null, Modifiers Add = Modifiers.None, Modifiers Remove = Modifiers.None)

Parameters

Fg Color?

Foreground color, or null to keep the existing one.

Bg Color?

Background color, or null to keep the existing one.

Add Modifiers

Modifiers to turn on.

Remove Modifiers

Modifiers to turn off.

Properties

Add

Modifiers to turn on.

public Modifiers Add { get; init; }

Property Value

Modifiers

Bg

Background color, or null to keep the existing one.

public Color? Bg { get; init; }

Property Value

Color?

Default

A style that changes nothing.

public static Style Default { get; }

Property Value

Style

Fg

Foreground color, or null to keep the existing one.

public Color? Fg { get; init; }

Property Value

Color?

Remove

Modifiers to turn off.

public Modifiers Remove { get; init; }

Property Value

Modifiers

Methods

Bold()

Returns this style with Bold added.

public Style Bold()

Returns

Style

CrossedOut()

Returns this style with CrossedOut added.

public Style CrossedOut()

Returns

Style

Dim()

Returns this style with Dim added.

public Style Dim()

Returns

Style

Italic()

Returns this style with Italic added.

public Style Italic()

Returns

Style

Patch(Style)

Combine two styles. other's non-null colors win, and its modifiers are applied on top of this style's.

public Style Patch(Style other)

Parameters

other Style

Returns

Style

Reversed()

Returns this style with Reversed added.

public Style Reversed()

Returns

Style

Underlined()

Returns this style with Underlined added.

public Style Underlined()

Returns

Style

WithBg(Color)

Returns this style with the given background color.

public Style WithBg(Color c)

Parameters

c Color

Returns

Style

WithFg(Color)

Returns this style with the given foreground color.

public Style WithFg(Color c)

Parameters

c Color

Returns

Style