struct ContentStyle
source · line 6public
public struct ContentStyle(val foregroundColor: Color? = None, val backgroundColor: Color? = None, val underlineColor: Color? = None, val attributes: Attributes = Attributes())
An immutable combination of optional foreground/background/underline colors and SGR attributes.
field attributes
source · line 10public
val attributes: Attributes = Attributes()
constructor constructor
source · line 6public
constructor(val foregroundColor: Color? = None, val backgroundColor: Color? = None, val underlineColor: Color? = None, val attributes: Attributes = Attributes())
parameter foregroundColor
source · line 7public
val foregroundColor: Color? = None
parameter underlineColor
source · line 9public
val underlineColor: Color? = None
parameter backgroundColor
source · line 8public
val backgroundColor: Color? = None
parameter attributes
source · line 10public
val attributes: Attributes = Attributes()
function withBackgroundColor
source · line 20public
public fun withBackgroundColor(color: Color?): ContentStyle
Returns a copy with the selected optional background color.
parameter color
source · line 20public
color: Color?
function withAttribute
source · line 30public
public fun withAttribute(attribute: Attribute): ContentStyle
Returns a copy with the selected attribute included.
parameter attribute
source · line 30public
attribute: Attribute
function withUnderlineColor
source · line 25public
public fun withUnderlineColor(color: Color?): ContentStyle
Returns a copy with the selected optional underline color.
parameter color
source · line 25public
color: Color?
function apply
source · line 40public
public fun <T : ToString> apply(content: T): StyledContent<T>
Pairs this style with content without writing to a terminal.
parameter content
source · line 40public
content: T
type parameter T
source · line 40public
T : ToString
field backgroundColor
source · line 8public
val backgroundColor: Color? = None
function withForegroundColor
source · line 15public
public fun withForegroundColor(color: Color?): ContentStyle
Returns a copy with the selected optional foreground color.
parameter color
source · line 15public
color: Color?
field underlineColor
source · line 9public
val underlineColor: Color? = None
field foregroundColor
source · line 7public
val foregroundColor: Color? = None
function withoutAttribute
source · line 35public
public fun withoutAttribute(attribute: Attribute): ContentStyle
Returns a copy without the selected attribute.
parameter attribute
source · line 35public
attribute: Attribute
function equals
source · line 6publiccompiler-derived
operator fun equals(other: ContentStyle): Boolean
This derived operation is available when each field or payload type supports same-type equality. Required types: Option<Color>, Attributes.