Styler

interface Styler

Interface for styling text components with various text formatting options.

Provides methods to apply colors, decorations, fonts, and merge styles to text components.

Functions

Link copied to clipboard
open fun aqua(): Styler

Applies aqua color to the text.

Link copied to clipboard
open fun black(): Styler

Applies black color to the text.

Link copied to clipboard
open fun blue(): Styler

Applies blue color to the text.

Link copied to clipboard
open fun bold(): Styler

Applies bold text decoration.

Link copied to clipboard
open fun changePage(page: Int): Styler
open fun changePage(page: String): Styler

Applies a click event that changes the page of a book.

Link copied to clipboard
abstract infix fun clickEvent(component: Component): Styler

Applies a click event from another component.

abstract infix fun clickEvent(event: ClickEvent): Styler

Applies a click event to the text.

Link copied to clipboard
abstract infix fun color(color: Int): Styler

Sets the color using an integer RGB value.

abstract infix fun color(hex: String): Styler

Sets the color using a hexadecimal string.

abstract infix fun color(color: TextColor): Styler

Sets the text color.

Link copied to clipboard
abstract infix fun colorIfAbsent(color: Int): Styler

Sets the color using an integer RGB value if no color is currently set.

abstract infix fun colorIfAbsent(hex: String): Styler

Sets the color using a hexadecimal string if no color is currently set.

abstract infix fun colorIfAbsent(color: TextColor): Styler

Sets the text color if no color is currently set.

Link copied to clipboard
abstract infix fun copyToClipboard(text: String): Styler

Applies a click event that copies text to the clipboard.

Link copied to clipboard
open fun darkBlue(): Styler

Applies dark blue color to the text.

Link copied to clipboard
open fun darkGray(): Styler

Applies dark gray color to the text.

Link copied to clipboard
open fun darkPurple(): Styler

Applies dark purple color to the text.

Link copied to clipboard
abstract infix fun decoration(decoration: Collection<TextDecoration>): Styler

Applies multiple text decorations.

abstract infix fun decoration(decoration: TextDecoration): Styler

Applies a text decoration.

Link copied to clipboard
open infix fun font(font: String): Styler

Sets the font for the text using a font key string.

abstract infix fun font(font: Key): Styler

Sets the font for the text.

Link copied to clipboard
abstract fun getGradient(): Gradient?

Internal method to retrieve the gradient implementation.

Link copied to clipboard
abstract fun gradient(vararg colors: TextColor): Styler

Applies a gradient of colors to the text.

abstract fun gradient(gradient: Gradient.() -> Unit): Styler

Applies a gradient of colors to the text using a DSL builder.

Link copied to clipboard
open fun gray(): Styler

Applies gray color to the text.

Link copied to clipboard
open fun green(): Styler

Applies green color to the text.

Link copied to clipboard
abstract infix fun hoverEvent(event: HoverEvent<*>): Styler

Applies a hover event to the text.

Link copied to clipboard
abstract infix fun insertion(text: String): Styler

Sets the text to be inserted when shift-clicked.

Link copied to clipboard
open fun italic(): Styler

Applies italic text decoration.

Link copied to clipboard
abstract infix fun mergeStyle(style: Component): Styler

Merges the style from the given component with the current style.

abstract infix fun mergeStyle(style: Style): Styler

Merges the given style with the current style.

Link copied to clipboard
abstract fun noBold(): Styler

Removes bold text decoration.

Link copied to clipboard
abstract fun noItalic(): Styler

Removes italic text decoration.

Link copied to clipboard
abstract fun noObfuscated(): Styler

Removes obfuscated text decoration.

Link copied to clipboard
abstract fun noStrikethrough(): Styler

Removes strikethrough text decoration.

Link copied to clipboard
abstract fun noUnderline(): Styler

Removes underline text decoration.

Link copied to clipboard
open fun obfuscated(): Styler

Applies obfuscated text decoration.

Link copied to clipboard
abstract infix fun openFile(file: String): Styler

Applies a click event that opens a file when clicked.

Link copied to clipboard
abstract infix fun openUrl(url: URL): Styler
abstract infix fun openUrl(url: String): Styler

Applies a click event that opens a URL when clicked.

Link copied to clipboard
open fun purple(): Styler

Applies light purple color to the text.

Link copied to clipboard
abstract fun rainbow(): Styler

Applies a rainbow effect to the text.

Link copied to clipboard
open fun red(): Styler

Applies red color to the text.

Link copied to clipboard
abstract fun reset(): Styler

Resets all styling to default values.

Link copied to clipboard
abstract infix fun runCommand(command: String): Styler

Applies a click event that runs a command when clicked.

Link copied to clipboard
abstract infix fun showEntity(key: HoverEvent.ShowEntity): Styler

Applies a hover event that shows an entity.

open fun showEntity(key: Key, uuid: UUID, name: Component = Component.empty()): Styler

Applies a hover event that shows an entity with the given key, UUID, and name.

Link copied to clipboard
abstract infix fun showItem(key: HoverEvent.ShowItem): Styler

Applies a hover event that shows an item.

open fun showItem(key: Key, count: Int): Styler

Applies a hover event that shows an item with the given key and count.

open fun showItem(key: Key, count: Int, data: Map<Key, DataComponentValue>): Styler

Applies a hover event that shows an item with the given key, count, and data components.

Link copied to clipboard
abstract fun showText(consumer: ComponentBuilder.() -> Unit): Styler

Applies a hover event that shows a component built with a DSL.

open infix fun showText(text: String): Styler

Applies a hover event that shows the given text.

abstract infix fun showText(component: Component): Styler

Applies a hover event that shows the given component.

Link copied to clipboard
open fun strikethrough(): Styler

Applies strikethrough text decoration.

Link copied to clipboard
abstract infix fun suggestCommand(command: String): Styler

Applies a click event that suggests a command in the chat box when clicked.

Link copied to clipboard
open fun underline(): Styler

Applies underline text decoration.

Link copied to clipboard
open fun whenFalse(condition: Boolean, overrider: Styler.() -> Unit): Styler

Applies styling conditionally when the condition is false.

Link copied to clipboard
abstract fun whenTrue(condition: Boolean, overrider: Styler.() -> Unit): Styler

Applies styling conditionally when the condition is true.

Link copied to clipboard
open fun white(): Styler

Applies white color to the text.

Link copied to clipboard
open fun yellow(): Styler

Applies yellow color to the text.