1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-11-16 20:25:58 +00:00

Compare commits

..

8 Commits

Author SHA1 Message Date
Justine De Caires
c6fcb3290e Update README 2022-03-30 19:20:08 -07:00
Justine De Caires
d342dd4cfd v14.0.2 2022-03-30 19:20:08 -07:00
Blake Gearin
c8180ff41f Remove no fill, duplicate path from 1f921 2022-03-30 18:21:48 -07:00
Šimon Brandner
9009625225 Use #F0FFFF instead of azure
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2022-03-30 18:21:24 -07:00
Gustav Odinger
aaf53724ae Add Twemoji Utils to Community Projects in README 2022-03-30 17:48:19 -07:00
Shahriar
7fb543eca3 Added Community Project: "Twemoji Cheatsheet"
Made by me
2022-03-30 17:39:38 -07:00
Mirone
9069bc50d3 feat(typescript): improve declarations 2022-03-30 17:14:23 -07:00
Justine De Caires
7c0e48149d Remove references to specific version numbers in most places 2022-03-30 17:03:58 -07:00
6 changed files with 58 additions and 12 deletions

View File

@ -4,7 +4,7 @@ A simple library that provides standard Unicode [emoji](http://en.wikipedia.org/
**Twemoji v14.0** adheres to the [Unicode 14.0 spec](https://unicode.org/versions/Unicode14.0.0/) and supports the [Emoji 14.0 spec](https://www.unicode.org/reports/tr51/tr51-21.html). _We do not support custom emoji._ **Twemoji v14.0** adheres to the [Unicode 14.0 spec](https://unicode.org/versions/Unicode14.0.0/) and supports the [Emoji 14.0 spec](https://www.unicode.org/reports/tr51/tr51-21.html). _We do not support custom emoji._
The Twemoji library offers support for **3,633** Unicode-defined emojis. The Twemoji library offers support for all Unicode-defined emoji which are recommended for general interchange (RGI).
## Usage ## Usage
@ -22,7 +22,7 @@ This guarantees that you will always use the latest version of the library.
If, instead, you'd like to include the latest version explicitly, you can add the following tag: If, instead, you'd like to include the latest version explicitly, you can add the following tag:
```html ```html
<script src="https://twemoji.maxcdn.com/v/14.0.1/twemoji.min.js" integrity="sha384-9XmaIHs67kvwAL3GE7nu7tddcROD/RBKYbYZcPd8KsVPdrA3U1574EW2PLtdTxDN" crossorigin="anonymous"></script> <script src="https://twemoji.maxcdn.com/v/14.0.2/twemoji.min.js" integrity="sha384-32KMvAMS4DUBcQtHG6fzADguo/tpN1Nh6BAJa2QqZc6/i0K+YPQE+bWiqBRAWuFs" crossorigin="anonymous"></script>
``` ```
### Download ### Download
@ -220,8 +220,10 @@ However, we consider the guide a bit onerous and as a project, will accept a men
## Community Projects ## Community Projects
* [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app) by [@ShahriarKh](https://github.com/ShahriarKh): An easy-to-use cheatsheet for exploring, copying and downloading emojis!
* [Twemoji Amazing](https://github.com/SebastianAigner/twemoji-amazing) by [@SebastianAigner](https://github.com/SebastianAigner): Use Twemoji using CSS classes (like [Font Awesome](http://fortawesome.github.io/Font-Awesome/)). * [Twemoji Amazing](https://github.com/SebastianAigner/twemoji-amazing) by [@SebastianAigner](https://github.com/SebastianAigner): Use Twemoji using CSS classes (like [Font Awesome](http://fortawesome.github.io/Font-Awesome/)).
* [Twemoji Ruby](https://github.com/jollygoodcode/twemoji) by [@JollyGoodCode](https://twitter.com/jollygoodcode): Use Twemoji in Ruby. * [Twemoji Ruby](https://github.com/jollygoodcode/twemoji) by [@JollyGoodCode](https://twitter.com/jollygoodcode): Use Twemoji in Ruby.
* [Twemoji Utils](https://github.com/gustavwilliam/twemoji-utils) by [@gustavwilliam](https://github.com/gustavwilliam): Utilities for finding and downloading Twemoji source files.
* [Twemoji for Pencil](https://github.com/nathanielw/Twemoji-for-Pencil) by [@Nathanielnw](https://twitter.com/nathanielnw): Use Twemoji in Pencil. * [Twemoji for Pencil](https://github.com/nathanielw/Twemoji-for-Pencil) by [@Nathanielnw](https://twitter.com/nathanielnw): Use Twemoji in Pencil.
* [FrwTwemoji - Twemoji in dotnet](http://github.frenchw.net/FrwTwemoji/) by [@FrenchW](https://twitter.com/frenchw): Use Twemoji in any dotnet project (C#, asp.net ...). * [FrwTwemoji - Twemoji in dotnet](http://github.frenchw.net/FrwTwemoji/) by [@FrenchW](https://twitter.com/frenchw): Use Twemoji in any dotnet project (C#, asp.net ...).
* [Emojiawesome - Twemoji for Yellow](https://github.com/datenstrom/yellow-extensions/tree/master/source/emojiawesome) by [@datenstrom](https://github.com/datenstrom/): Use Twemoji on your website. * [Emojiawesome - Twemoji for Yellow](https://github.com/datenstrom/yellow-extensions/tree/master/source/emojiawesome) by [@datenstrom](https://github.com/datenstrom/): Use Twemoji on your website.

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><circle fill="#4289C1" cx="29" cy="3" r="2"/><circle fill="#4289C1" cx="33" cy="8" r="3"/><circle fill="#4289C1" cx="33" cy="4" r="3"/><circle fill="#4289C1" cx="7" cy="3" r="2"/><circle fill="#4289C1" cx="3" cy="8" r="3"/><circle fill="#4289C1" cx="3" cy="4" r="3"/><path fill="#FEE7B8" d="M36 18c0 9.941-8.059 18-18 18S0 27.941 0 18 8.059 0 18 0s18 8.059 18 18"/><circle fill="#4289C1" cx="30.5" cy="4.5" r="2.5"/><circle fill="#4289C1" cx="32" cy="7" r="2"/><circle fill="#4289C1" cx="5.5" cy="4.5" r="2.5"/><circle fill="#4289C1" cx="4" cy="7" r="2"/><circle fill="#FF7892" cx="6.93" cy="21" r="4"/><circle fill="#FF7892" cx="28.93" cy="21" r="4"/><path fill="#DA2F47" d="M27.335 23.629c-.178-.161-.444-.171-.635-.029-.039.029-3.922 2.9-8.7 2.9-4.766 0-8.662-2.871-8.7-2.9-.191-.142-.457-.13-.635.029-.177.16-.217.424-.094.628C8.7 24.472 11.788 31 18 31s9.301-6.528 9.429-6.743c.123-.205.084-.468-.094-.628z"/><path fill="none" d="M27.335 23.629c-.178-.161-.444-.171-.635-.029-.039.029-3.922 2.9-8.7 2.9-4.766 0-8.662-2.871-8.7-2.9-.191-.142-.457-.13-.635.029-.177.16-.217.424-.094.628C8.7 24.472 11.788 31 18 31s9.301-6.528 9.429-6.743c.123-.205.084-.468-.094-.628z"/><ellipse fill="#664500" cx="11.5" cy="11.5" rx="2.5" ry="3.5"/><ellipse fill="#664500" cx="25.5" cy="11.5" rx="2.5" ry="3.5"/><circle fill="#BB1A34" cx="18.5" cy="19.5" r="3.5"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><circle fill="#4289C1" cx="29" cy="3" r="2"/><circle fill="#4289C1" cx="33" cy="8" r="3"/><circle fill="#4289C1" cx="33" cy="4" r="3"/><circle fill="#4289C1" cx="7" cy="3" r="2"/><circle fill="#4289C1" cx="3" cy="8" r="3"/><circle fill="#4289C1" cx="3" cy="4" r="3"/><path fill="#FEE7B8" d="M36 18c0 9.941-8.059 18-18 18S0 27.941 0 18 8.059 0 18 0s18 8.059 18 18"/><circle fill="#4289C1" cx="30.5" cy="4.5" r="2.5"/><circle fill="#4289C1" cx="32" cy="7" r="2"/><circle fill="#4289C1" cx="5.5" cy="4.5" r="2.5"/><circle fill="#4289C1" cx="4" cy="7" r="2"/><circle fill="#FF7892" cx="6.93" cy="21" r="4"/><circle fill="#FF7892" cx="28.93" cy="21" r="4"/><path fill="#DA2F47" d="M27.335 23.629c-.178-.161-.444-.171-.635-.029-.039.029-3.922 2.9-8.7 2.9-4.766 0-8.662-2.871-8.7-2.9-.191-.142-.457-.13-.635.029-.177.16-.217.424-.094.628C8.7 24.472 11.788 31 18 31s9.301-6.528 9.429-6.743c.123-.205.084-.468-.094-.628z"/><ellipse fill="#664500" cx="11.5" cy="11.5" rx="2.5" ry="3.5"/><ellipse fill="#664500" cx="25.5" cy="11.5" rx="2.5" ry="3.5"/><circle fill="#BB1A34" cx="18.5" cy="19.5" r="3.5"/></svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

52
index.d.ts vendored
View File

@ -1,3 +1,14 @@
/**
* If given to parse, this callback will be invoked per each found emoji.
*
* If this callback returns a falsy value instead of a valid `src` to use for the image, nothing will actually change for that specific emoji.
*
* @param icon the lower case HEX code point i.e. "1f4a9"
* @param options all info for this parsing operation
* @param variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored.
*/
declare type ParseCallback = (icon: string, options: object, variant: string) => string | false;
declare interface TwemojiOptions { declare interface TwemojiOptions {
/** /**
* Default: MaxCDN * Default: MaxCDN
@ -22,19 +33,52 @@ declare interface TwemojiOptions {
/** /**
* The function to invoke in order to generate image src(s). * The function to invoke in order to generate image src(s).
*/ */
callback?(icon: string, options: TwemojiOptions): void; callback?: ParseCallback
/** /**
* The function to invoke in order to generate additional, custom attributes for the image tag.
* Default () => ({}) * Default () => ({})
* @param icon the lower case HEX code point i.e. "1f4a9"
* @param variant variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored.
*
*/ */
attributes?(): void; attributes?(icon: string, variant: string): object;
} }
declare type Twemoji = { declare type Twemoji = {
convert: { convert: {
/**
* Given an HEX codepoint, returns UTF16 surrogate pairs.
*
* @param codepoint string generic codepoint, i.e. '1F4A9'
* @return string codepoint transformed into utf16 surrogates pair,
* i.e. \uD83D\uDCA9
*
* @example
* twemoji.convert.fromCodePoint('1f1e8');
* // "\ud83c\udde8"
*
* '1f1e8-1f1f3'.split('-').map(twemoji.convert.fromCodePoint).join('')
* // "\ud83c\udde8\ud83c\uddf3"
*/
fromCodePoint(hexCodePoint: string): string; fromCodePoint(hexCodePoint: string): string;
toCodePoint(utf16surrogatePairs: string): string;
/**
* Given UTF16 surrogate pairs, returns the equivalent HEX codepoint.
*
* @param utf16surrogatePairs string generic utf16 surrogates pair, i.e. \uD83D\uDCA9
* @param sep string optional separator for double code points, default='-'
* @return string utf16 transformed into codepoint, i.e. '1F4A9'
*
* @example
* twemoji.convert.toCodePoint('\ud83c\udde8\ud83c\uddf3');
* // "1f1e8-1f1f3"
*
* twemoji.convert.toCodePoint('\ud83c\udde8\ud83c\uddf3', '~');
* // "1f1e8~1f1f3"
*/
toCodePoint(utf16surrogatePairs: string, sep?: string): string;
}; };
parse(node: HTMLElement | string, options?: TwemojiOptions): void; parse<T extends string | HTMLElement>(node: T, options?: TwemojiOptions | ParseCallback): T;
}; };
declare module 'twemoji' { declare module 'twemoji' {

View File

@ -34,7 +34,7 @@
<body> <body>
<h1>Twem&#x2764;ji</h1> <h1>Twem&#x2764;ji</h1>
<p>Sharing Twitter emoji <a href="2/test/preview.html">everywhere</a></p> <p>Sharing Twitter emoji <a href="2/test/preview.html">everywhere</a></p>
<p><strong>Version 12.0 Is Out!</strong></p> <p><strong>Version 14.0 Is Out!</strong></p>
<p><a href="https://github.com/twitter/twemoji">Grab me on GitHub &#x2197;</a></p> <p><a href="https://github.com/twitter/twemoji">Grab me on GitHub &#x2197;</a></p>
<p> <p>
<a href="https://twitter.com/intent/tweet?button_hashtag=TwemojiParty&text=thank%20you%20Twitter%20for%20the%20emoji" class="twitter-hashtag-button" data-size="large" data-related="twitteross" data-url="http://twitter.github.io/twemoji/">Tweet #TwemojiParty</a> <a href="https://twitter.com/intent/tweet?button_hashtag=TwemojiParty&text=thank%20you%20Twitter%20for%20the%20emoji" class="twitter-hashtag-button" data-size="large" data-related="twitteross" data-url="http://twitter.github.io/twemoji/">Tweet #TwemojiParty</a>

View File

@ -1,11 +1,11 @@
{ {
"version": "14.0.1", "version": "14.0.2",
"name": "twemoji", "name": "twemoji",
"license": [ "license": [
"MIT", "MIT",
"CC-BY-4.0" "CC-BY-4.0"
], ],
"description": "A Unicode 13.0 standard based way to implement emoji across all platforms.", "description": "A Unicode standard based way to implement emoji across all platforms.",
"homepage": "https://github.com/twitter/twemoji", "homepage": "https://github.com/twitter/twemoji",
"keywords": [ "keywords": [
"emoji", "emoji",