style

inline fun style(consumer: Styler.() -> Unit): Style

Creates a text style using a DSL builder pattern.

This function provides a convenient way to construct Adventure text styles using a builder DSL. The consumer lambda receives a Styler instance that allows configuring style properties such as color, decorations, click events, and more.

Return

The built Style instance

Example usage:

val customStyle = style {
color(NamedTextColor.GOLD)
decoration(TextDecoration.BOLD, true)
clickEvent(ClickEvent.runCommand("/help"))
}

Parameters

consumer

A lambda with receiver that configures the style builder