turtle: github.com/hackebrot/turtle Index | Examples | Files

package turtle

import "github.com/hackebrot/turtle"

Package turtle is a library for working with emojis. The API ca be used to retrieve emoji for a specific name, a category or a keyword. You can also search emojis if you do not know the name of an emoji.



Package Files

doc.go emojis.go filters.go turtle.go


const Version = "v0.1.0"

Version of the turtle library


var Emojis = make(map[string]*Emoji)

Emojis maps a name to an Emoji

var EmojisByChar = make(map[string]*Emoji)

EmojisByChar maps a character to an Emoji

type Emoji Uses

type Emoji struct {
    Name     string   `json:"name" toml:"name"`
    Category string   `json:"category" toml:"category"`
    Char     string   `json:"char" toml:"char"`
    Keywords []string `json:"keywords" toml:"keywords"`

Emoji holds info about an emoji character

func Category Uses

func Category(c string) []*Emoji

Category filters the emojis by a category

Example for using the Category function to find all emojis of the specified category.


c := "travel_and_places"
emojis := Category(c)

if emojis == nil {
    fmt.Fprintf(os.Stderr, "no emojis found for category: %v\n", c)

fmt.Printf("%s: %s\n", c, emojis[:3])


travel_and_places: [🚡 ✈️ 🚑]

func Filter Uses

func Filter(f func(e *Emoji) bool) []*Emoji

Filter the emojis based on the given comparison function

Example for using the Filter function to find all emojis in a category with a specific keyword


emojis := Filter(func(e *Emoji) bool {
    if e.Category == "animals_and_nature" {
        for _, keyword := range e.Keywords {
            if keyword == "world" {
                return true
    return false

if emojis == nil {
    fmt.Fprintf(os.Stderr, "no emojis found in animals_and_nature with keyword world\n")

fmt.Printf("emojis: %s", emojis)


emojis: [🌍 🌎 🌏]

func Keyword Uses

func Keyword(k string) []*Emoji

Keyword filters the emojis by a keyword

Example for using the Keyword function to find all emojis with the specified keyword.


k := "happy"
emojis := Keyword(k)

if emojis == nil {
    fmt.Fprintf(os.Stderr, "no emoji found for keyword: %v\n", k)

fmt.Printf("%s: %s", k, emojis[:4])


happy: [😊 😁 😀 😂]
func Search(s string) []*Emoji

Search emojis by a name

func (Emoji) String Uses

func (e Emoji) String() string

String implementation for Emoji

Package turtle imports 1 packages (graph) and is imported by 2 packages. Updated 2020-07-12. Refresh now. Tools for package owners.