Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/n7st/go-ircformat

Golang IRC text formatting helpers
https://github.com/n7st/go-ircformat

color colours formatting go golang irc

Last synced: 9 days ago
JSON representation

Golang IRC text formatting helpers

Awesome Lists containing this project

README

        

# `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:

```go
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:

```go
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:

```go
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

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

// ...
}
```