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.
- Host: GitHub
- URL: https://github.com/danielgtaylor/unistyle
- Owner: danielgtaylor
- License: mit
- Created: 2019-02-18T05:24:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-18T05:43:20.000Z (over 6 years ago)
- Last Synced: 2025-05-08T03:55:13.872Z (5 months ago)
- Topics: fun, golang, library, styles, unicode, unicode-characters
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unistyle
[](https://godoc.org/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 mainimport (
"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/