🎼 The emoji code utilities for JavaScript
- Node v10 or later
- Modern browsers
- Internet Explorer 11 is supported
$ yarn add @emoji-gen/ecode # for Yarn users
$ npm install @emoji-gen/ecode --save # for NPM users
const { EcodeEncoder } = require('@emoji-gen/ecode')
const ecodeEncoder = new EcodeEncoder()
const ecode = ecodeDecoder.encode({
locale: 'en',
flags: {
sizeFixed: true,
stretch: true,
},
align: 'center',
size: 'xhdpi',
format: 'webp',
fontId: 0xcf,
foregroundColor: {
value: 0x12345678,
},
backgroundColor: {
value: 0x9abcdef0,
},
text: 'ab\nc',
})
console.log(ecode)
// => 'BA0hzxI0VniavN7wYWIKYw'
const { EcodeDecoder } = require('@emoji-gen/ecode')
const ecodeDecoder = new EcodeDecoder()
const ecode = ecodeDecoder.decode('BA0hzxI0VniavN7wYWIKYw')
console.log(ecode)
// => {
// version: 1,
// locale: 'en',
// flags: {
// sizeFixed: false,
// stretch: true
// },
// align: 'center',
// size: 'xhdpi',
// format: 'webp',
// fontId: 207,
// foregroundColor: {
// value: 305419896,
// hex: '12345678'
// },
// backgroundColor: {
// value: 2596069104,
// hex: '9abcdef0'
// },
// text: 'ab\nc'
// }
$ yarn test
$ yarn run build
Name | Language |
---|---|
ecode-java | Java |
ecode-py | Python |
MIT © Emoji Generator