Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Color ¶
type Color rune
Color is a Minecraft color code type
var ( // Black is Minecraft color code §0 (#000000) Black Color = '0' // DarkBlue is Minecraft color code §1 (#0000aa) DarkBlue Color = '1' // DarkGreen is Minecraft color code §2 (#00aa00) DarkGreen Color = '2' // DarkAqua is Minecraft color code §3 (#00aaaa) DarkAqua Color = '3' // DarkRed is Minecraft color code §4 (#aa0000) DarkRed Color = '4' // DarkPurple is Minecraft color code §5 (#aa00aa) DarkPurple Color = '5' // Gold is Minecraft color code §6 (#ffaa00) Gold Color = '6' // Gray is Minecraft color code §7 (#aaaaaa) Gray Color = '7' // DarkGray is Minecraft color code §8 (#555555) DarkGray Color = '8' // Blue is Minecraft color code §9 (#5555ff) Blue Color = '9' // Green is Minecraft color code §a (#55ff55) Green Color = 'a' // Aqua is Minecraft color code §b (#55ffff) Aqua Color = 'b' // Red is Minecraft color code §c (#ff5555) Red Color = 'c' // LightPurple is Minecraft color code §d (#ff55ff) LightPurple Color = 'd' // Yellow is Minecraft color code §e (#ffff55) Yellow Color = 'e' // White is Minecraft color code §f (#ffffff) White Color = 'f' // MinecoinGold is Minecraft color code §g (#ddd605) MinecoinGold Color = 'g' )
func ParseColor ¶
func ParseColor(value interface{}) Color
ParseColor attempts to return a Color type based on a color code string, color name string, or a Color type itself
type FormatItem ¶
type FormatItem struct { Text string `json:"text"` Color Color `json:"color"` Obfuscated bool `json:"obfuscated"` Bold bool `json:"bold"` Strikethrough bool `json:"strikethrough"` Underline bool `json:"underline"` Italic bool `json:"italic"` }
FormatItem is a single formatting item that contains a color and any optional formatting controls
func (FormatItem) Clean ¶
func (i FormatItem) Clean() string
Clean returns the text only of the formatting item
func (FormatItem) HTML ¶
func (i FormatItem) HTML() (result string)
HTML returns the HTML representation of the format item. A <span> tag is used as well as the style and class attributes. Obfuscation is encoded as a class with the name 'minecraft-format-obfuscated'.
func (FormatItem) Raw ¶
func (i FormatItem) Raw() (result string)
Raw returns the Minecraft encoding of the formatting (§ + formatting codes/color + text)
type Formatting ¶
type Formatting struct { Tree []FormatItem `json:"-"` Raw string `json:"raw"` Clean string `json:"clean"` HTML string `json:"html"` }
Formatting is a parsed structure of any Minecraft string encoded with color codes or format codes
func ParseFormatting ¶
func ParseFormatting(desc interface{}, defaultColor ...Color) (res *Formatting, err error)
ParseFormatting parses the formatting of any string or Chat object