Table of Contents

Class ChatRoleStyle

Namespace
SharpConsoleUI.Controls
Assembly
SharpConsoleUI.dll

Defines the visual presentation of messages belonging to a specific ChatRole. All properties are init-only; create a new instance (or use with expressions) to customise.

public sealed class ChatRoleStyle
Inheritance
ChatRoleStyle
Inherited Members
Extension Methods

Properties

Background

Optional background colour for the message body area. May carry an alpha value (via Color.WithAlpha) so the compositor blends it over the window background. When null the panel's default background is used.

public Color? Background { get; init; }

Property Value

Color?

BorderColor

An explicit border colour override. When null the colour is derived from ColorRole and the active theme.

public Color? BorderColor { get; init; }

Property Value

Color?

Collapsible

Whether messages for this role can be collapsed by the user. Defaults to false.

public bool Collapsible { get; init; }

Property Value

bool

ColorRole

The ColorRole used to colour the message panel. Defaults to Default.

public ColorRole ColorRole { get; init; }

Property Value

ColorRole

DefaultActions

Optional actions seeded onto every message of this role at creation time (unless the AddMessage call supplies its own explicit actions, which override these). null (default) seeds no actions.

public IReadOnlyList<ChatMessageAction>? DefaultActions { get; init; }

Property Value

IReadOnlyList<ChatMessageAction>

Header

Optional factory that produces the header text from the role and an optional author name. When null a built-in label is used ("You", "Assistant", …).

public Func<ChatRole, string?, string>? Header { get; init; }

Property Value

Func<ChatRole, string, string>

HeaderAlignment

Horizontal alignment of the header text inside the panel header row. Defaults to Left.

public HorizontalAlignment HeaderAlignment { get; init; }

Property Value

HorizontalAlignment

HeaderGradient

Optional gradient applied to the header text. When non-null the header is rendered with a colour sweep from From to To.

public (Color From, Color To)? HeaderGradient { get; init; }

Property Value

(Color From, Color To)?

HeaderStyle

The header/border style of the message panel. Defaults to Borderless.

public CollapsibleHeaderStyle HeaderStyle { get; init; }

Property Value

CollapsibleHeaderStyle

Margin

The outer margin applied to each message panel, creating visual spacing between messages. Defaults to new Margin(0, 0, 0, 1) (one blank line below).

public Margin Margin { get; init; }

Property Value

Margin

Markdown

Whether the message body is rendered as Markdown (wrapped in a [markdown]…[/] markup tag). Defaults to true.

public bool Markdown { get; init; }

Property Value

bool

Selectable

Per-role override for whether this role's message body allows text selection. null (default) inherits the control-level MessagesSelectable; true forces selection on for this role even when the control master is off; false forces it off even when the master is on.

public bool? Selectable { get; init; }

Property Value

bool?

ShowHeader

Whether to render a header row for this role's messages. Defaults to true.

public bool ShowHeader { get; init; }

Property Value

bool

StartCollapsed

When Collapsible is true, whether messages start in the collapsed (header-only) state. Useful for verbose roles such as System or Tool. Defaults to false.

public bool StartCollapsed { get; init; }

Property Value

bool