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

https://github.com/danielgtaylor/unistyle

ā„±š’¶š“ƒš’øš“Ž š˜š—²š˜…š˜ š˜“š˜µš˜ŗš˜­š˜¦š˜“ š”£š”¬š”Æ G̳o̳l̳a̳n̳g̳ in a compact, zero dependency library.
https://github.com/danielgtaylor/unistyle

fun golang library styles unicode unicode-characters

Last synced: 5 months ago
JSON representation

ā„±š’¶š“ƒš’øš“Ž š˜š—²š˜…š˜ š˜“š˜µš˜ŗš˜­š˜¦š˜“ š”£š”¬š”Æ G̳o̳l̳a̳n̳g̳ in a compact, zero dependency library.

Awesome Lists containing this project

README

          

# Unistyle

[![GoDoc](https://godoc.org/github.com/danielgtaylor/unistyle?status.svg)](https://godoc.org/github.com/danielgtaylor/unistyle) [![Go Report Card](https://goreportcard.com/badge/github.com/danielgtaylor/unistyle)](https://goreportcard.com/report/github.com/danielgtaylor/unistyle)

Unicode text styles for Go:

- š—•š—¼š—¹š—±
- š˜š˜µš˜¢š˜­š˜Ŗš˜¤
- U̲n̲d̲e̲r̲l̲i̲n̲e̲
- S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶
- š’žš“Šš“‡š“ˆš’¾š“‹ā„Æ
- š”Šš”¬š”±š”„š”¦š” 
- And more! See the [docs](https://godoc.org/github.com/danielgtaylor/unistyle)

## How does this work?

These styles are split into two categories:

1. Unicode includes a table of [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_character) that can be used to modify the previous character in a string. This allows for effects like underline, overline, and strikethrough.

2. Unicode includes multiple styles for most common characters. Using a character offset replacement mapping you can transform strings into their bold, italic, cursive or other styled equivalents.

## Usage Example

Here is a small example. See the tests for more.

```go
package main

import (
"fmt"
"github.com/danielgtaylor/unistyle"
)

func main() {
// Diacritic examples
fmt.Println(unistyle.Bold("Bold text"))
fmt.Println(unistyle.Strikethrough("Strike", unistyle.StrikeStrokeLong))

// Character mapping examples
fmt.Println(unistyle.Cursive("Cursive"))
fmt.Println(unistyle.Fraktur("Gothic"))
}
```

# License

Copyright Ā© 2019 Daniel G. Taylor

https://dgt.mit-license.org/