Skip to content

n7st/go-ircformat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-ircformat

This package contains IRC text formatting and coloring helpers.

Installation

go get -u github.com/n7st/go-ircformat

Features

Text coloring

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),
    })

    // ...
}

Emphasis

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")

    // ...
}

Combining colors and emphasis

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),
    }))

    // ...
}