Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I just wrote my own... Seems like adding an entire library for this is definitely overkill.

    var emojify = function(message) {
        var codes = [
          '\ud83c[\udf00-\udfff]',
          '\ud83d[\udc00-\ude4f]',
          '\ud83d[\ude80-\udeff]'
        ];
        return message.replace(new RegExp(codes.join('|'), 'g'), '<span class="emoji">$&</span>');
      }
Edit: If this isn't clear, you'd then define an emoji based font family for the `emoji` CSS class. This means no image based emoji and therefore no colour, but IMO it's much simpler and actually more visually pleasing (black and white forces smarter emoji designs).


The library is simple and works well for us and Tweetdeck. Everyone is welcome to tweak it.

The value like stated in the blog is that the permissive licensing of this project/graphics will enable more spread of emoji across platforms. (see something like this blog for why licensing has been a PITA: http://words.steveklabnik.com/emoji-licensing)




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: