chat

package
v0.0.0-...-93368d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2015 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package chat defines color and format codes and a set of helper functions.

Many, many thanks to #mcdevs from Freenode and it's great documentation: http://wiki.vg/Chat

Index

Examples

Constants

View Source
const (
	Black     = "§0" // #000
	DarkBlue  = "§1" // #00a
	DarkGreen = "§2" // #0a0
	DarkCyan  = "§3" // #0aa
	DarkRed   = "§4" // #a00
	Purple    = "§5" // #a0a
	Gold      = "§6" // #fa0
	Gray      = "§7" // #aaa
	DarkGray  = "§8" // #555
	Blue      = "§9" // #55f
	Green     = "§a" // #5f5
	Cyan      = "§b" // #5ff
	Red       = "§c" // #f55
	Pink      = "§d" // #f5f
	Yellow    = "§e" // #ff5
	White     = "§f" // #fff

	Random     = "§k"
	Bold       = "§l"
	Strike     = "§m"
	Underlined = "§n"
	Italic     = "§o"
	Rest       = "§r"
)

Variables

This section is empty.

Functions

func IsColor

func IsColor(s string) bool

IsColor checks if s contains a color code. If len([]rune(s)) != 2 returns false.

func IsFormat

func IsFormat(s string) bool

IsColor checks if s contains a format code. If len([]rune(s)) != 2 returns false.

func Strip

func Strip(s string) string

Strip deletes any chat control sequence.

func StripColor

func StripColor(s string) string

StripColor deletes color control sequences.

func StripFormat

func StripFormat(s string) string

StripFormat deletes format control sequences.

func Translate

func Translate(s, pat string) string

Translate translates strings using an alternate control sequence char to a string that uses '§' as control sequence char.

Example
package main

import (
	"fmt"

	"github.com/minero/minero/chat"
)

func main() {
	t := chat.Translate("Roses are &cred&r. Violets are &9blue§r. Let's f***!", "&")
	fmt.Println(t)
}
Output:

Roses are §cred§r. Violets are §9blue§r. Let's f***!

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL