styled

fun String.styled(provider: StyledStringBuilder.Provider, defaultTextStyle: KalugaTextStyle, vararg attributes: StringStyleAttribute): StyledString

Creates a StyledString from a String

Return

a StyledString styled with all attributes

Parameters

provider
defaultTextStyle

the KalugaTextStyle to apply when no StringStyleAttribute are set for a given range

attributes

a collection of StringStyleAttribute to apply to the entire string


fun String.styled(provider: StyledStringBuilder.Provider, defaultTextStyle: KalugaTextStyle, linkColor: KalugaColor, vararg attributes: StringStyleAttribute): StyledString

Creates a StyledString from a String

Return

a StyledString styled with all attributes

Parameters

provider
defaultTextStyle

the KalugaTextStyle to apply when no StringStyleAttribute are set for a given range

linkColor

the KalugaColor to apply to the LinkStyle of the StyledString

attributes

a collection of StringStyleAttribute to apply to the entire string


fun String.styled(provider: StyledStringBuilder.Provider, defaultTextStyle: KalugaTextStyle, linkStyle: LinkStyle?, vararg attributes: StringStyleAttribute): StyledString

Creates a StyledString from a String

Return

a StyledString styled with all attributes

Parameters

provider
defaultTextStyle

the KalugaTextStyle to apply when no StringStyleAttribute are set for a given range

linkStyle

the LinkStyle to apply to the StyledString

attributes

a collection of StringStyleAttribute to apply to the entire string


fun String.styled(provider: StyledStringBuilder.Provider, defaultTextStyle: KalugaTextStyle, vararg attributes: String.() -> Pair<StringStyleAttribute, IntRange>?): StyledString

Creates a StyledString from a String

Return

a StyledString styled with all attributes

Parameters

provider
defaultTextStyle

the KalugaTextStyle to apply when no StringStyleAttribute are set for a given range

attributes

a collection methods that create a Pair of StringStyleAttribute and the IntRange at which it should be applied

Throws

if attributes returns an IntRange out of bounds for the String


fun String.styled(provider: StyledStringBuilder.Provider, defaultTextStyle: KalugaTextStyle, linkColor: KalugaColor, vararg attributes: String.() -> Pair<StringStyleAttribute, IntRange>?): StyledString

Creates a StyledString from a String

Return

a StyledString styled with all attributes

Parameters

provider
defaultTextStyle

the KalugaTextStyle to apply when no StringStyleAttribute are set for a given range

linkColor

the KalugaColor to apply to the LinkStyle of the StyledString

attributes

a collection methods that create a Pair of StringStyleAttribute and the IntRange at which it should be applied

Throws

if attributes returns an IntRange out of bounds for the String


fun String.styled(provider: StyledStringBuilder.Provider, defaultTextStyle: KalugaTextStyle, linkStyle: LinkStyle?, vararg attributes: String.() -> Pair<StringStyleAttribute, IntRange>?): StyledString

Creates a StyledString from a String

Return

a StyledString styled with all attributes

Parameters

provider
defaultTextStyle

the KalugaTextStyle to apply when no StringStyleAttribute are set for a given range

linkStyle

the LinkStyle to apply to the StyledString

attributes

a collection methods that create a Pair of StringStyleAttribute and the IntRange at which it should be applied

Throws

if attributes returns an IntRange out of bounds for the String