MyNixOS website logo
Description

The OpenMoji emoji dataset.

This library simply exposes the OpenMoji emoji dataset as some data in Haskell

hs-openmoji-data

Built with Nix Haskell Hackage Hackage CI Github CI BSD3 License

The OpenMoji emoji dataset for use in Haskell programs.

For emoji fonts, images, and spritesheets, please consult the documentation at openmoji.org.

Updating the emojis

Use nix-thunk to update the pinned version of openmoji and then use the generator script to produce a new Data.hs file:

nix-thunk update ./openmoji
./gen.sh

Versioning

Versions of this package should correspond to the OpenMoji version number used to generate the data.

Example Usage


> {-# Language LambdaCase #-}
> {-# Language OverloadedStrings #-}
>
> import Control.Monad
> import Data.Map (Map)
> import qualified Data.Map as Map
> import Data.Text (Text)
> import qualified Data.Text as T
> import System.Environment
> import Text.Emoji (emojiFromAlias)
> import Text.Emoji.OpenMoji.Data
> import Text.Emoji.OpenMoji.Types
>
> emojiMap :: Map Text OpenMoji
> emojiMap = Map.fromList $ map (\x -> (_openMoji_emoji x, x)) openmojis
> 
> main :: IO ()
> main = do
>   requestedAliases <- getArgs
>   when (null requestedAliases) $
>     putStrLn "Please search for at least one emoji alias (e.g., \"bricks\")"
>   forM_ requestedAliases $ \alias ->
>     case (\e -> Map.lookup e emojiMap) =<< emojiFromAlias (T.pack alias) of
>       Nothing -> putStrLn $ "Results for '" <> alias <> "': None"
>       Just openmoji -> do
>         putStrLn $ "Results for '" <> alias <> "':"
>         printOpenMojiInfo openmoji
>
> versionedSvg :: Text -> Text -> Text
> versionedSvg rev hex = mconcat
>   [ "https://raw.githubusercontent.com/hfg-gmuend/openmoji/"
>   , rev
>   , "/color/svg/"
>   , hex
>   , ".svg"
>   ]
>
> pinnedRevision :: Text
> pinnedRevision = "4a80b536eb62a78822548a2aa371426f912d7e9d" -- v13
>
> printOpenMojiInfo :: OpenMoji -> IO ()
> printOpenMojiInfo o = putStrLn $ T.unpack $ T.unlines
>   [ "Emoji:      " <> _openMoji_emoji o
>   , "Hexcode:    " <> _openMoji_hexcode o
>   , "Annotation: " <> _openMoji_annotation o
>   , "Group:      " <> _openMoji_group o
>   , "Sub-Group:  " <> _openMoji_subgroups o
>   , "Tags:       " <> T.intercalate ", " (_openMoji_tags o)
>   , "SVG:        " <> versionedSvg pinnedRevision (_openMoji_hexcode o)
>   ]

This program will do something like the following:

Results for 'bricks':
Emoji:      🧱
Hexcode:    1F9F1
Annotation: brick
Group:      travel-places
Sub-Group:  place-building
Tags:       bricks, clay, mortar, wall
SVG:        https://raw.githubusercontent.com/hfg-gmuend/openmoji/4a80b536eb62a78822548a2aa371426f912d7e9d/color/svg/1F9F1.svg

Results for 'pilot':
Emoji:      🧑‍✈️
Hexcode:    1F9D1-200D-2708-FE0F
Annotation: pilot
Group:      people-body
Sub-Group:  person-role
Tags:       plane
SVG:        https://raw.githubusercontent.com/hfg-gmuend/openmoji/4a80b536eb62a78822548a2aa371426f912d7e9d/color/svg/1F9D1-200D-2708-FE0F.svg

About the Emojis

All emojis designed by OpenMoji – the open-source emoji and icon project. License: CC BY-SA 4.0

Metadata

Version

15.0.0

Executables (1)

  • bin/readme

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows