README.md (view raw)
1# emoji :rocket: :school_satchel: :tada:
2[![Build Status](https://github.com/enescakir/emoji/workflows/build/badge.svg?branch=master)](https://github.com/enescakir/emoji/actions)
3[![godoc](https://godoc.org/github.com/enescakir/emoji?status.svg)](https://godoc.org/github.com/enescakir/emoji)
4[![Go Report Card](https://goreportcard.com/badge/github.com/enescakir/emoji)](https://goreportcard.com/report/github.com/enescakir/emoji)
5[![Codecov](https://img.shields.io/codecov/c/github/enescakir/emoji)](https://codecov.io/gh/enescakir/emoji)
6[![MIT License](https://img.shields.io/github/license/enescakir/emoji)](https://github.com/enescakir/emoji/blob/master/LICENSE)
7
8`emoji` is a minimalistic emoji library for Go. It lets you use emoji characters in strings.
9
10Inspired by [spatie/emoji](https://github.com/spatie/emoji)
11
12## Install :floppy_disk:
13``` bash
14go get github.com/enescakir/emoji
15```
16
17## Usage :surfer:
18```go
19package main
20
21import (
22 "fmt"
23
24 "github.com/enescakir/emoji"
25)
26
27func main() {
28 fmt.Printf("Hello %v\n", emoji.WavingHand)
29 fmt.Printf("I am %v from %v\n",
30 emoji.ManTechnologist,
31 emoji.FlagForTurkiye,
32 )
33 fmt.Printf("Different skin tones.\n default: %v light: %v dark: %v\n",
34 emoji.ThumbsUp,
35 emoji.OkHand.Tone(emoji.Light),
36 emoji.CallMeHand.Tone(emoji.Dark),
37 )
38 fmt.Printf("Emojis with multiple skin tones.\n both medium: %v light and dark: %v\n",
39 emoji.PeopleHoldingHands.Tone(emoji.Medium),
40 emoji.PeopleHoldingHands.Tone(emoji.Light, emoji.Dark),
41 )
42 fmt.Println(emoji.Parse("Emoji aliases are :sunglasses:"))
43 emoji.Println("Use fmt wrappers :+1: with emoji support :tada:")
44}
45
46/* OUTPUT
47
48 Hello π
49 I am π¨βπ» from πΉπ·
50 Different skin tones.
51 default: π light: ππ» dark: π€πΏ
52 Emojis with multiple skin tones.
53 both medium: π§π½βπ€βπ§π½ light and dark: π§π»βπ€βπ§πΏ
54 Emoji aliases are π
55 Use fmt wrappers π with emoji support π
56*/
57```
58
59This package contains emojis constants based on [Full Emoji List v13.0](https://unicode.org/Public/emoji/13.0/emoji-test.txt).
60```go
61emoji.CallMeHand // π€
62emoji.CallMeHand.Tone(emoji.Dark) // π€πΏ
63```
64Also, it has additional emoji aliases from [github/gemoji](https://github.com/github/gemoji).
65```go
66emoji.Parse(":+1:") // π
67emoji.Parse(":100:") // π―
68```
69
70You can generate country flag emoji with [ISO 3166 Alpha2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) codes:
71```go
72emoji.CountryFlag("tr") // πΉπ·
73emoji.CountryFlag("US") // πΊπΈ
74emoji.Parse("country flag alias :flag-gb:") // country flag alias π¬π§
75```
76
77All constants are generated by `internal/generator`.
78
79## Testing :hammer:
80``` bash
81go test
82```
83
84## Todo :pushpin:
85* Add examples to `godoc`
86
87## Contributing :man_technologist:
88I am accepting PRs that add aliases to the package.
89You have to add it to `customEmojis` list at `internal/generator/main`.
90
91If you think an emoji constant is not correct, open an issue.
92Please use [this list](http://unicode.org/emoji/charts/full-emoji-list.html)
93to look up the correct unicode value and the name of the character.
94
95## Credits :star:
96- [Enes ΓakΔ±r](https://github.com/enescakir)
97
98## License :scroll:
99The MIT License (MIT). Please see [License File](LICENSE.md) for more information.