Top Related Projects
Easy to parse data and spritesheets for emoji
Emoji for everyone. https://twemoji.twitter.com/
Noto Emoji fonts
[Archived] The world's largest independent emoji font. Maintained at https://github.com/joypixels/emoji-toolkit.
πͺ One component to pick them all
Quick Overview
GitHub's gemoji is a Ruby library and command-line tool for working with emoji. It provides a comprehensive database of emoji, including their Unicode characters, aliases, and tags. The project also includes utilities for converting between emoji formats and generating emoji image assets.
Pros
- Comprehensive emoji database with Unicode characters, aliases, and tags
- Supports conversion between various emoji formats (Unicode, aliases, images)
- Includes a command-line tool for easy emoji-related tasks
- Regularly updated to include new emoji
Cons
- Limited to Ruby ecosystem, may not be suitable for projects in other languages
- Requires manual updates to stay current with new emoji releases
- Large image assets can increase project size if included
Code Examples
- Getting emoji information:
require 'gemoji'
emoji = Emoji.find_by_alias("smile")
puts emoji.raw
puts emoji.name
puts emoji.description
puts emoji.tags.join(", ")
- Converting emoji aliases to Unicode:
require 'gemoji'
text = "I :heart: Ruby!"
puts Emoji.replace_named_moji_with_unicode(text)
- Finding emoji by Unicode character:
require 'gemoji'
emoji = Emoji.find_by_unicode("π")
puts emoji.name
puts emoji.aliases.join(", ")
Getting Started
To use gemoji in your Ruby project, add this line to your application's Gemfile:
gem 'gemoji'
Then execute:
$ bundle install
Or install it yourself as:
$ gem install gemoji
To use gemoji in your Ruby code, require it at the top of your file:
require 'gemoji'
Now you can use the Emoji class to work with emoji in your Ruby application.
Competitor Comparisons
Easy to parse data and spritesheets for emoji
Pros of emoji-data
- More comprehensive emoji dataset, including metadata and properties
- Regular updates with new emoji releases
- Provides multiple image formats (PNG, SVG) and sizes
Cons of emoji-data
- Larger file size due to extensive data and image assets
- May require more processing to integrate into projects
- Less focused on specific platform implementations (e.g., GitHub)
Code Comparison
emoji-data:
{
"name": "grinning face",
"unified": "1F600",
"non_qualified": null,
"docomo": null,
"au": "E471",
"softbank": "E057",
"google": "FE332",
"image": "1f600.png",
"sheet_x": 30,
"sheet_y": 24,
"short_name": "grinning",
"short_names": ["grinning"],
"text": null,
"texts": null,
"category": "Smileys & Emotion",
"subcategory": "face-smiling",
"sort_order": 1,
"added_in": "6.0",
"has_img_apple": true,
"has_img_google": true,
"has_img_twitter": true,
"has_img_facebook": true
}
gemoji:
{
":grinning:" => {
:name => "grinning face",
:unicode_version => "6.1",
:emoji_version => "2.0",
:description => "grinning face",
:category => "Smileys & Emotion",
:aliases => ["grinning"],
:tags => ["smile", "happy"],
:unicode => "1f600"
}
}
Both repositories provide emoji data, but emoji-data offers more detailed information and cross-platform support, while gemoji focuses on GitHub-specific implementations with a simpler data structure.
Emoji for everyone. https://twemoji.twitter.com/
Pros of Twemoji
- Larger and more comprehensive emoji set
- SVG format allows for scalable, high-quality rendering
- Regular updates to include new emoji standards
Cons of Twemoji
- Larger file size due to SVG format
- May require additional processing for web integration
- Less native support in some platforms compared to Unicode emoji
Code Comparison
Gemoji (Ruby):
Emoji.find_by_alias("smile").raw
# => "π"
Twemoji (JavaScript):
twemoji.parse('I \u2764\uFE0F emoji!');
// => 'I <img class="emoji" draggable="false" alt="β€οΈ" src="https://twemoji.maxcdn.com/v/latest/svg/2764.svg"/> emoji!'
Summary
Gemoji focuses on providing a simple Ruby library for working with emoji, primarily using Unicode characters. It's lightweight and easy to integrate into Ruby projects.
Twemoji offers a more comprehensive set of emoji as SVG images, making it suitable for high-quality visual representations across various platforms and screen sizes. However, it requires more setup and processing for web integration.
The choice between the two depends on the specific project requirements, target platforms, and desired visual quality.
Noto Emoji fonts
Pros of noto-emoji
- Comprehensive set of emoji covering a wide range of Unicode standards
- High-quality vector graphics for scalability and crisp rendering
- Consistent design across all emoji, ensuring a cohesive visual experience
Cons of noto-emoji
- Larger file size due to the extensive collection and vector format
- May require more processing power to render complex vector graphics
- Less frequent updates compared to gemoji
Code comparison
noto-emoji (SVG format):
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
<path fill="#FFCC4D" d="M64 118.3c-30 0-54.3-24.3-54.3-54.3S34 9.7 64 9.7s54.3 24.3 54.3 54.3S94 118.3 64 118.3z"/>
<path fill="#664500" d="M64 98c-16.6 0-30-13.4-30-30h60c0 16.6-13.4 30-30 30z"/>
</svg>
gemoji (Unicode format):
EMOJI_ALIASES = {
"smile" => "π",
"laughing" => "π",
"blush" => "π",
"smiley" => "π",
"relaxed" => "βΊοΈ"
}
The code comparison shows that noto-emoji uses SVG format for scalable graphics, while gemoji primarily deals with Unicode characters and their aliases.
[Archived] The world's largest independent emoji font. Maintained at https://github.com/joypixels/emoji-toolkit.
Pros of EmojiOne
- Larger emoji set with more diverse and inclusive options
- Regular updates to keep up with new Unicode emoji standards
- Cross-platform compatibility and consistent rendering
Cons of EmojiOne
- Licensing restrictions for commercial use
- Larger file size due to more extensive emoji set
- May require more setup and configuration
Code Comparison
Gemoji:
emoji = Emoji.find_by_alias("smile")
puts emoji.raw
EmojiOne:
import { emojione } from 'emojione';
console.log(emojione.shortnameToUnicode(':smile:'));
Key Differences
- Gemoji is primarily focused on GitHub-specific emoji usage, while EmojiOne aims for broader application across various platforms.
- Gemoji is open-source and free to use, whereas EmojiOne has different licensing tiers for commercial use.
- EmojiOne provides more comprehensive tools for emoji conversion and rendering, while Gemoji offers a simpler, more straightforward approach.
Use Cases
- Gemoji is ideal for GitHub-centric projects or applications that require a lightweight emoji solution.
- EmojiOne is better suited for cross-platform applications, social media platforms, or projects that need a wide range of emoji options and consistent rendering across devices.
πͺ One component to pick them all
Pros of emoji-mart
- More comprehensive emoji picker component with search, categories, and customization options
- Active development with frequent updates and new features
- Cross-platform support (React, Vue, and vanilla JS)
Cons of emoji-mart
- Larger package size due to additional features and dependencies
- Steeper learning curve for implementation compared to gemoji's simpler approach
- May be overkill for projects that only need basic emoji support
Code Comparison
emoji-mart:
import { Picker } from 'emoji-mart'
<Picker set='apple' onSelect={this.addEmoji} />
gemoji:
require 'gemoji'
Emoji.find_by_alias("heart").raw
Summary
emoji-mart offers a more feature-rich emoji picker component with cross-platform support, making it ideal for projects requiring advanced emoji functionality. However, it comes with a larger package size and potentially more complex implementation. gemoji, on the other hand, provides a simpler approach to emoji handling, focusing on basic emoji support and integration with Ruby projects. The choice between the two depends on the specific requirements of your project and the desired level of emoji functionality.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
gemoji
This library contains character information about native emojis.
Installation
Add gemoji
to your Gemfile.
gem 'gemoji'
Example Rails Helper
This would allow emojifying content such as: it's raining :cat:s and :dog:s!
See the Emoji cheat sheet for more examples.
module EmojiHelper
def emojify(content)
h(content).to_str.gsub(/:([\w+-]+):/) do |match|
if emoji = Emoji.find_by_alias($1)
%(<img alt="#$1" src="#{image_path("emoji/#{emoji.image_filename}")}" style="vertical-align:middle" width="20" height="20" />)
else
match
end
end.html_safe if content.present?
end
end
Unicode mapping
Translate emoji names to unicode and vice versa.
>> Emoji.find_by_alias("cat").raw
=> "Γ°ΒΒΒ±" # Don't see a cat? That's U+1F431.
>> Emoji.find_by_unicode("\u{1f431}").name
=> "cat"
Adding new emoji
You can add new emoji characters to the Emoji.all
list:
emoji = Emoji.create("music") do |char|
char.add_alias "song"
char.add_unicode_alias "\u{266b}"
char.add_tag "notes"
end
emoji.name #=> "music"
emoji.raw #=> "Γ’ΒΒ«"
emoji.image_filename #=> "unicode/266b.png"
# Creating custom emoji (no Unicode aliases):
emoji = Emoji.create("music") do |char|
char.add_tag "notes"
end
emoji.custom? #=> true
emoji.image_filename #=> "music.png"
As you create new emoji, you must ensure that you also create and put the images
they reference by their image_filename
to your assets directory.
You can customize image_filename
with:
emoji = Emoji.create("music") do |char|
char.image_filename = "subdirectory/my_emoji.gif"
end
For existing emojis, you can edit the list of aliases or add new tags in an edit block:
emoji = Emoji.find_by_alias "musical_note"
Emoji.edit_emoji(emoji) do |char|
char.add_alias "music"
char.add_unicode_alias "\u{266b}"
char.add_tag "notes"
end
Emoji.find_by_alias "music" #=> emoji
Emoji.find_by_unicode "\u{266b}" #=> emoji
Top Related Projects
Easy to parse data and spritesheets for emoji
Emoji for everyone. https://twemoji.twitter.com/
Noto Emoji fonts
[Archived] The world's largest independent emoji font. Maintained at https://github.com/joypixels/emoji-toolkit.
πͺ One component to pick them all
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot