node-emoji icon indicating copy to clipboard operation
node-emoji copied to clipboard

Emoji selectors

Open emanuelbuholzer opened this issue 7 years ago • 20 comments

It would be very useful if the API could provide selector functions which allow the user to get all emojis and these of a given category. What do you think?

I'd work on that if everybody agrees 😃

emanuelbuholzer avatar Jan 08 '17 22:01 emanuelbuholzer

This would be interesting, especially for applications that let users pick emoji. A PR would be very welcome :grin:

omnidan avatar Jan 09 '17 09:01 omnidan

Yes that's why I'd need it. Okay, so I'll start working on it.

emanuelbuholzer avatar Jan 09 '17 10:01 emanuelbuholzer

I just checked out the code and this will be a lot of repetitive boring work. Does anyone have an idea to do this without a simple manual made mapping table?

If not, I'll do the manual work :sob:

emanuelbuholzer avatar Jan 09 '17 10:01 emanuelbuholzer

@emanuelbuholzer maybe you can find a list that groups emoji in categories, e.g. on a website - then you could automatically read this into a category: [emoji, ...] mapping with a little bit of JS magic :sparkles:

omnidan avatar Jan 09 '17 10:01 omnidan

After some more, I stillt haven't found a way of grouping them together automatiaclly. I'll put this into the list of "things I'll do at a suitable time in the future". I'll put all work into a branch - if anyone want's to help

emanuelbuholzer avatar Jan 18 '17 22:01 emanuelbuholzer

@omnidan, I actually sorted the emoji array. And succeeded. This is the sorted array, like:

const emoji = require('node-emoji')
// array transfer
var result = [];
for (var i in emoji.emoji)
	result.push(emoji.emoji[i])
// sort
result = result.sort();
// People category 1156 to 1236 (Namely 80 pieces)
result = result.slice(1156, 1236)
// end
result == ["😀", "😁", "😂", "😃", "😄", "😅", "😆", "😆", "😇", "😈", "😉", "😊", "😋", "😌", "😍", "😎", "😏", "😐", "😑", "😒", "😓", "😔", "😕", "😖", "😗", "😘", "😙", "😚", "😛", "😜", "😝", "😞", "😟", "😠", "😡", "😢", "😣", "😤", "😥", "😦", "😧", "😨", "😩", "😪", "😫", "😬", "😭", "😮", "😯", "😰", "😱", "😲", "😳", "😴", "😵", "😶", "😷", "😸", "😹", "😺", "😻", "😼", "😽", "😾", "😿", "🙀", "🙁", "🙂", "🙃", "🙄", "🙅", "🙆", "🙇", "🙈", "🙉", "🙊", "🙋", "🙌", "🙍", "🙎"]

abdurrahmanekr avatar Jun 13 '17 18:06 abdurrahmanekr

Thanks, that makes the whole process a lot easier. I'll work on category support in the next few days.

emanuelbuholzer avatar Jun 13 '17 19:06 emanuelbuholzer

If everybody agrees I'll implement categories according to recommended sort order, which is the default ordering of emoji characters from Unicode CLDR data.

For more information about the categories visit: http://unicode.org/emoji/charts/emoji-ordering.html

emanuelbuholzer avatar Jun 17 '17 21:06 emanuelbuholzer

@emanuelbuholzer Looks good to me 👍

abdurrahmanekr avatar Jun 17 '17 22:06 abdurrahmanekr

@emanuelbuholzer looks good :+1: would be nice if you could implement category support and submit a PR :grin:

omnidan avatar Jul 04 '17 20:07 omnidan

I started working on category support. If I'd implement it according to the source above (http://unicode.org/emoji/charts/emoji-ordering.html), the technique for getting emojis showed by @abdurrahmanekr would not work. It looks like the ordering isn't the same as the ordering within the Unicode CLDR data, furthermore it looks like some emojis are missing.

As an alternative I could implement category support like within most emoji keyboards/selectors or we could refactor the codebase, so that it is close to the Unicode CLDR data. What do you all think?

emanuelbuholzer avatar Jul 11 '17 18:07 emanuelbuholzer

I think this file can be useful. As it seems to me that they've already categorized based on unicode. In that case, we can simply update the build script, and leave some credit.

https://github.com/OneSignal/emoji-picker/blob/master/lib/js/config.js#L851

smeijer avatar Jul 15 '17 21:07 smeijer

Some icons are not showing, why?

Gotemperor avatar Sep 05 '17 13:09 Gotemperor

Do you have an example @Gotemperor?

smeijer avatar Sep 05 '17 15:09 smeijer

I am using localhost on my linux machine, so I can not gice you an example, but I see also missing icons when I open the github repository examples, they look like that , "🙁", "🙂", "🙃", "🙄", "🙅", "🙆", "🙇", "🙈", "🙉", "🙊", "🙋", "🙌", "🙍", "🙎"

Gotemperor avatar Sep 05 '17 18:09 Gotemperor

hmm, strange, they look ok here, but not ok on my localhost, can it be related to my localhost, to linux, or to missing font files? I used npm to install

Gotemperor avatar Sep 05 '17 18:09 Gotemperor

@Gotemperor github defines fallback images for unsupported emoji. it seems like your platform does not support the latest emoji set. I tried running the example code on macOS 10.12.6 and they all show up fine for me (in the console).

omnidan avatar Sep 05 '17 19:09 omnidan

Hey guys, I noticed this is an old post. Did this feature get considered on any release? @emanuelbuholzer is this something you are still working on?

GaryTowers avatar Mar 16 '20 14:03 GaryTowers

@GaryTowers I'm pretty sure emojilib proves data for this to be possible. If we were to add this to node-emoji it would be using it.

Richienb avatar Mar 16 '20 19:03 Richienb

@GaryTowers I wrote a script to parse a json file with emojis and their respective categories. I uploaded the script and the json output to wdfinch/emojis-json-formatted.

In the json folder, you'll find a file containing a bunch of emojis organized by category and sub-category. Additionally, you'll find a file that contains a single large json object in a compatible format with this library.

Let me know if this works for you.

wdfinch avatar Mar 24 '20 22:03 wdfinch