Documentation
¶
Overview ¶
Package mini provides utilities for parsing and manipulating Minecraft text colors and styles. It includes functions for parsing strings with embedded style information, modifying styles, and creating gradient effects. It also provides functions for parsing color names and hex codes, and for linear interpolation of colors.
Credits to the partial Go port of MiniMessage (https://docs.advntr.dev/minimessage/index.html) by https://github.com/emortalmc/GateProxy/blob/main/minimessage/minimessage.go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromName ¶
FromName takes a string as input and returns a `color.Color` object. It iterates over the named colors and returns the one that matches the input string.
func Gradient ¶
Gradient takes a string, a style, and a variable number of colors as input and returns a `c.Text` object. It creates a gradient effect by interpolating between the input colors based on their position in the input string.
func LerpColor ¶
LerpColor takes a float and a variable number of colors as input and returns a `color.Color` object. It interpolates between the input colors based on the input float.
func Parse ¶
Parse takes a string as input and returns a `c.Text` object. It splits the input string by "<", then further splits each substring by ">". It modifies the style based on the key (the part before ">") and appends a new text component with the modified style and content (the part after ">").
func ParseColor ¶
ParseColor takes a string as input and returns a `color.Color` object. It checks if the input string starts with "#". If it does, it tries to parse it as a hex color. If it doesn't, it tries to find a named color that matches the input string.
Types ¶
This section is empty.