File: README.md

package info (click to toggle)
golang-github-enescakir-emoji 1.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 472 kB
  • sloc: makefile: 3
file content (99 lines) | stat: -rw-r--r-- 3,295 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# emoji :rocket: :school_satchel: :tada:
[![Build Status](https://github.com/enescakir/emoji/workflows/build/badge.svg?branch=master)](https://github.com/enescakir/emoji/actions)
[![godoc](https://godoc.org/github.com/enescakir/emoji?status.svg)](https://godoc.org/github.com/enescakir/emoji)
[![Go Report Card](https://goreportcard.com/badge/github.com/enescakir/emoji)](https://goreportcard.com/report/github.com/enescakir/emoji)
[![Codecov](https://img.shields.io/codecov/c/github/enescakir/emoji)](https://codecov.io/gh/enescakir/emoji)
[![MIT License](https://img.shields.io/github/license/enescakir/emoji)](https://github.com/enescakir/emoji/blob/master/LICENSE)

`emoji` is a minimalistic emoji library for Go. It lets you use emoji characters in strings.

Inspired by [spatie/emoji](https://github.com/spatie/emoji)

## Install :floppy_disk:
``` bash
go get github.com/enescakir/emoji
```

## Usage :surfer:
```go
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](https://unicode.org/Public/emoji/13.0/emoji-test.txt).
```go
emoji.CallMeHand // πŸ€™
emoji.CallMeHand.Tone(emoji.Dark) // πŸ€™πŸΏ
```
Also, it has additional emoji aliases from [github/gemoji](https://github.com/github/gemoji).
```go
emoji.Parse(":+1:") // πŸ‘
emoji.Parse(":100:") // πŸ’―
```

You can generate country flag emoji with [ISO 3166 Alpha2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) codes:
```go
emoji.CountryFlag("tr") // πŸ‡ΉπŸ‡·
emoji.CountryFlag("US") // πŸ‡ΊπŸ‡Έ
emoji.Parse("country flag alias :flag-gb:") // country flag alias πŸ‡¬πŸ‡§
```

All constants are generated by `internal/generator`.

## Testing :hammer:
``` bash
go test
```

## Todo :pushpin:
* Add examples to `godoc`

## Contributing :man_technologist:
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](http://unicode.org/emoji/charts/full-emoji-list.html)
to look up the correct unicode value and the name of the character.

## Credits :star:
- [Enes Γ‡akΔ±r](https://github.com/enescakir)

## License :scroll:
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.