π π π
emoji
emoji
is a minimalistic emoji library for Go. It lets you use emoji characters in strings.
Inspired by spatie/emoji
Install πΎ
go get github.com/enescakir/emoji
π
Usage package main
import (
"fmt"
"github.com/enescakir/emoji"
)
func main() {
fmt.Printf("Hello %v\n", emoji.WavingHand)
fmt.Printf("I am %v from %v\n",
emoji.ManTechnologist,
emoji.FlagForTurkey,
)
fmt.Printf("Different skin tones.\n default: %v light: %v dark: %v\n",
emoji.ThumbsUp,
emoji.OkHand.Tone(emoji.Light),
emoji.CallMeHand.Tone(emoji.Dark),
)
fmt.Printf("Emojis with multiple skin tones.\n both medium: %v light and dark: %v\n",
emoji.PeopleHoldingHands.Tone(emoji.Medium),
emoji.PeopleHoldingHands.Tone(emoji.Light, emoji.Dark),
)
fmt.Println(emoji.Parse("Emoji aliases are :sunglasses:"))
emoji.Println("Use fmt wrappers :+1: with emoji support :tada:")
}
/* OUTPUT
Hello π
I am π¨βπ» from πΉπ·
Different skin tones.
default: π light: ππ» dark: π€πΏ
Emojis with multiple skin tones.
both medium: π§π½βπ€βπ§π½ light and dark: π§π»βπ€βπ§πΏ
Emoji aliases are π
Use fmt wrappers π with emoji support π
*/
This package contains emojis constants based on Full Emoji List v13.0.
emoji.CallMeHand // π€
emoji.CallMeHand.Tone(emoji.Dark) // π€πΏ
Also, it has additional emoji aliases from github/gemoji.
emoji.Parse(":+1:") // π
emoji.Parse(":100:") // π―
You can generate country flag emoji with ISO 3166 Alpha2 codes:
emoji.CountryFlag("tr") // πΉπ·
emoji.CountryFlag("US") // πΊπΈ
emoji.Parse("country flag alias :flag-gb:") // country flag alias π¬π§
All constants are generated by internal/generator
.
Testing π¨
go test
π
Todo - Add examples to
godoc
Contributing π¨βπ»
I am accepting PRs that add aliases to the package.
You have to add it to customEmojis
list at internal/generator/main
.
If you think an emoji constant is not correct, open an issue. Please use this list to look up the correct unicode value and the name of the character.
Credits β
π
License The MIT License (MIT). Please see License File for more information.