This package contains IRC text formatting and coloring helpers.
go get -u github.com/n7st/go-ircformat
There are specific helpers for foreground text colors:
import ircColor "github.com/n7st/go-ircformat/color"
func main() {
redText := ircColor.Red("some text")
// ...
}
There is a helper for applying both foreground and background coloring:
import ircColor "github.com/n7st/go-ircformat/color"
func main() {
redTextWhiteYellowBackground := ircColor.Color("my text", &ircColor.Colors{
Background: ircColor.New(ircColor.ColorYellow),
Foreground: ircColor.New(ircColor.ColorRed),
})
// ...
}
There are helpers for bold, italic, underline, strikethrough and monospace:
import ircEmphasis "github.com/n7st/go-ircformat/emphasis"
func main() {
boldText := ircEmphasis.Bold("my text")
italicText := ircEmphasis.Italic("my text")
underlineText := ircEmphasis.Underline("my text")
strikethroughText := ircEmphasis.Strikethrough("my text")
monospaceText := ircEmphasis.Monospace("my text")
// ...
}
import (
ircColor "github.com/n7st/go-ircformat/color"
ircEmphasis "github.com/n7st/go-ircformat/emphasis"
)
func main() {
boldRedText := ircEmphasis.Bold(ircColor.Red("my text"))
boldRedYellowText := ircEmphasis.Bold(ircColor.Color("my text", &ircColor.Colors{
Background: ircColor.New(ircColor.ColorYellow),
Foreground: ircColor.New(ircColor.ColorRed),
}))
// ...
}