Skip to content

Instantly share code, notes, and snippets.

@rfl890
Created July 24, 2023 15:21
Show Gist options
  • Save rfl890/5652f27938a7f4bbddd1f2e8272a565f to your computer and use it in GitHub Desktop.
Save rfl890/5652f27938a7f4bbddd1f2e8272a565f to your computer and use it in GitHub Desktop.
Noto Color Emoji Userscript
// ==UserScript==
// @name Better emojis
// @namespace Violentmonkey Scripts
// @match *://*/*
// @grant none
// @version 1.0
// @run-at document-end
// @author -
// @description Replaces the default emoji font on your device. Works with newer browsers (Chrome & Edge 98+, Firefox 107+, Opera 100+)
// ==/UserScript==
const fontURL = document.location.protocol + "//fonts.googleapis.com/css2?family=Noto+Colr+Emoji+Glyf";
const stylesheet = document.createElement("link");
stylesheet.setAttribute("rel", "stylesheet");
stylesheet.setAttribute("href", fontURL);
stylesheet.setAttribute("crossorigin", "anonymous");
document.head.appendChild(stylesheet);
for (const sheet of document.styleSheets) {
try {
for (const rule of sheet.cssRules) {
if (rule.style?.fontFamily?.length > 0) {
rule.style.fontFamily = rule.style.fontFamily + `, "Noto Colr Emoji Glyf"`;
}
}
} catch (e) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment