fluentui-emoji-js

1.1.1 • Public • Published

fluentui-emoji-js

A JavaScript wrapper for Microsoft's Fluent Emojis.

View on NPM | View Live Demo

Fluent Emoji

Usage

Install

npm install fluentui-emoji-js

Import

const emoji = require('fluentui-emoji-js')
// or
import * as emoji from 'fluentui-emoji-js'

Examples

Common JS

const emoji = require('fluentui-emoji-js')

emoji.fromGlyph('👋','3D').then((emojiFile) => {
  console.log(emojiFile)
})

ES Module

import * as emoji from 'fluentui-emoji-js'

const emojiFile = await emoji.fromGlyph('👋','3D')
console.log(emojiFile)

Displaying the emoji

Both fromGlyph(glyph, style) and fromCode(code, style) return the location of the emoji image relative to the base emoji folder. You can download the assets folder from the fluentui-emoji repo or use a service like jsdelivr to get the emoji image.

Getting emoji image via jsdelivr

const emojiImage = document.querySelector('#emojiImage');
const emoji = '🍕';

emoji.fromGlyph(emoji,'3D').then((emojiFile) => {
  emojiImage.src = `https://cdn.jsdelivr.net/gh/microsoft/fluentui-emoji@latest/assets${emojiFile}`
})

More Info

fluentui-emoji-js has 2 main functions fromGlyph(glyph, style) and fromCode(code, style). Both return the location of the emoji image relative to the base emoji folder.

fromGlyph(glyph, style)

  • glyph: string contaning an emoji
  • style: string '3D', 'Color', 'Flat', or 'High Contrast'

fromCode(code, style)

  • code: string contaning the unicode for an emoji
    • code should be just the hexcode. ex.'1f44b' not 'U+1F44B'
  • style: string '3D', 'Color', 'Flat', or 'High Contrast'

Readme

Keywords

Package Sidebar

Install

npm i fluentui-emoji-js

Weekly Downloads

151

Version

1.1.1

License

MIT

Unpacked Size

1.59 MB

Total Files

17

Last publish

Collaborators

  • zacharycrespin