by hlaueriksson
:octocat: GitHub Emoji for C#, dotnet and beyond
# Add to your Claude Code skills
git clone https://github.com/hlaueriksson/GEmojiSharpGitHub Emoji for C# and .NET:
netstandard2.0- ASP.NET Core
- Blazor
dotnettool- PowerToys Run plugin
- PowerToys Command Palette extension
- MCP Server
๐ :octopus:
โ :heavy_plus_sign:
๐ :cat2:
โฉต
โค๏ธ :heart:
No comments yet. Be the first to share your thoughts!
Using emojis on GitHub is accomplish with emoji aliases enclosed by colons:
:+1: This PR looks great - it's ready to merge! :shipit:
:+1: This PR looks great - it's ready to merge! :shipit:
GEmojiSharp make this possible in C#. The library contains a static array of all valid emoji in GitHub Flavored Markdown.
That is the intersection of the emoji.json database and the API with available emojis.
A visual referense of all GitHub Emoji:
GEmojiSharpGitHub Emoji for C# and .NET ๐ฆ
Static methods:
Emoji.Get(":tada:").Raw; // ๐
Emoji.Get("๐").Alias(); // :tada:
Emoji.Raw(":tada:"); // ๐
Emoji.Alias("๐"); // :tada:
Emoji.Emojify(":tada: initial commit"); // ๐ initial commit
Emoji.Demojify("๐ initial commit"); // :tada: initial commit
Emoji.Find("party popper").First().Raw; // ๐
Emoji.Get("โ๏ธ").RawSkinToneVariants(); // โ๐ป, โ๐ผ, โ๐ฝ, โ๐พ, โ๐ฟ
Extension methods:
":tada:".GetEmoji().Raw; // ๐
"๐".GetEmoji().Alias(); // :tada:
":tada:".RawEmoji(); // ๐
"๐".EmojiAlias(); // :tada:
":tada: initial commit".Emojify(); // ๐ initial commit
"๐ initial commit".Demojify(); // :tada: initial commit
"party popper".FindEmojis().First().Raw; // ๐
Regular expression pattern to match all emojis:
var text = "Lorem ๐๐ ipsum";
var matches = Regex.Matches(text, Emoji.RegexPattern);
string.Join(string.Empty, matches.Select(x => x.Value)); // ๐๐
Regex.Replace(text, Emoji.RegexPattern, string.Empty); // Lorem ipsum
GEmojiSharp.AspNetCoreGitHub Emoji for ASP.NET Core ๐ฆ
The package includes:
Update the _ViewImports.cshtml file, to enable tag helpers in all Razor views:
@addTagHelper *, GEmojiSharp.AspNetCore
Use the <emoji> tag or emoji attribute to render emojis:
<span emoji=":tada:"></span>
<emoji>:tada: initial commit</emoji>
Standard emoji characters are rendered like this:
<g-emoji class="g-emoji" alias="tada" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f389.png">๐</g-emoji>
Custom GitHub emojis are rendered as images:
<img class="emoji" title=":octocat:" alt=":octocat:" src="https://github.githubassets.com/images/icons/emoji/octocat.png" height="20" width="20" align="absmiddle">
Use CSS to properly position the custom GitHub emojis images:
.emoji {
background-color: transparent;
max-width: none;
vertical-align: text-top;
}
Use the JavaScript from g-emoji-element to support old browsers.
Backports native emoji characters to browsers that don't support them by replacing the characters with fallback images.
Add a libman.json file:
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"provider": "unpkg",
"library": "@github/g-emoji-element@1.2.0",
"destination": "wwwroot/lib/g-emoji-element/"
}
]
}
And add the script to the _Layout.cshtml file:
<script src="~/lib/g-emoji-element/dist/index.js"></script>
Do you want to use emoji anywhere, on any tag, in the body? Then you can use the BodyTagHelperComponent.
Use any tag to render emojis:
<h1>Hello, :earth_africa:</h1>
Registration via services container:
using GEmojiSharp.AspNetCore;
using Microsoft.AspNetCore.Razor.TagHelpers;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
builder.Services.AddTransient<ITagHelperComponent, BodyTagHelperComponent>();
Registration via Razor file:
@page
@model GEmojiSharp.Sample.Web.Pages.ComponentModel
@using Microsoft.AspNetCore.Mvc.Razor.TagHelpers
@using GEmojiSharp.AspNetCore
@inject ITagHelperComponentManager manager;
@{
ViewData["Title"] = "Component";
manager.Components.Add(new BodyTagHelperComponent());
}
Registration via Page Model or controller:
using GEmojiSharp.AspNetCore;
using Microsoft.AspNetCore.Mvc.Razor.TagHelpers;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace GEmojiSharp.Sample.Web.Pages
{
public class ComponentModel : PageModel
{
private readonly ITagHelperComponentManager _tagHelperComponentManager;
public IndexModel(ITagHelperComponentManager tagHelperComponentManager)
{
_tagHelperComponentManager = tagHelperComponentManager;
}
public void OnGet()
{
_tagHelperComponentManager.Components.Add(new BodyTagHelperComponent());
}
}
}
Update the _ViewImports.cshtml file, to enable HTML helpers in all Razor views:
@using GEmojiSharp.AspNetCore
Use the Emoji extension methods to render emojis:
@Html.Emoji(":tada: initial commit")
@Html.Emoji(x => x.Text)
GEmojiSharp.BlazorGitHub Emoji for Blazor ๐ฆ
The package is a Razor class library (RCL) with a Razor component.
Update the _Imports.razor file, to enable the component in all Razor views:
@using GEmojiSharp.Blazor
[!NOTE] In a Blazor Web App (.NET 8 or later), the component requires an interactive render mode applied either globally to the app or to the component definition.
Set the global render mode in App.razor:
<Routes @rendermode="InteractiveServer" />
or per page/component:
@rendermode InteractiveServer
Use the <Emoji> component to render emojis:
<Emoji>:tada: initial commit</Emoji>
Standard emoji characters are rendered like this:
<g-emoji class="g-emoji" alias="tada" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f389.png">๐</g-emoji>
Custom GitHub emojis are rendered as images:
<img class="emoji" title=":octocat:" alt=":octocat:" src="https://github.githubassets.com/images/icons/emoji/octocat.png" height="20" width="20" align="absmiddle">
GEmojiSharp.DotnetToolGitHub Emoji
dotnettool ๐งฐ

Install:
dotnet tool install -g GEmojiSharp.DotnetTool
Update:
dotnet tool update -g GEmojiSharp.DotnetTool
Uninstall:
dotnet tool uninstall -g GEmojiSharp.DotnetTool
Enable emoji in the terminal:
