all repos — emoji @ 7a25cdeb568bc3347ea800ba141d97ebb7d87637

A minimalistic emoji package for Go (golang)

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.