Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@canvacord/emoji-parser

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@canvacord/emoji-parser

Emoji parser for canvacord.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
159
decreased by-8.09%
Maintainers
2
Weekly downloads
 
Created
Source

Emoji Parser

Emoji parser for Canvacord.

Emojis

  • twemoji
  • discord emojis

Installing

$ npm i @canvacord/emoji-parser

Example

const Canvas = require("canvas");
const { fillTextWithTwemoji } = require("@canvacord/emoji-parser");
const fs = require("fs");

const canvas = Canvas.createCanvas(500, 270);
const ctx = canvas.getContext("2d");

ctx.fillStyle = "#FFFFFF";
ctx.fillRect(0, 0, canvas.width, canvas.height);

ctx.fillStyle = "#FF0000";
ctx.font = "32px Arial";

fillTextWithTwemoji(ctx, "Hello World 😊 <:kek:750253062689652768>", 120, 150)
    .then(() => {
        fs.writeFileSync("./img.png", canvas.toBuffer())
    })
    .catch(console.error);

With Typescript

import { fillTextWithTwemoji } from "@canvacord/emoji-parser";

Preview

Preview

Available Methods

fillTextWithEmoji(context: CanvasRenderingContext2D, text: string, x: number, y: number, options?: DrawTextWithEmojiParams): Promise

Renders emojis with fillType: "fill".

strokeTextWithEmoji(context: CanvasRenderingContext2D, text: string, x: number, y: number, options?: DrawTextWithEmojiParams): Promise

Renders emojis with fillType: "stroke".

drawTextWithEmoji(context: CanvasRenderingContext2D, fillType: "fill" | "stroke", text: string, x: number, y: number, options?: DrawTextWithEmojiParams): Promise

Main method used by both fillTextWithEmoji and strokeTextWithEmoji.

Keywords

FAQs

Package last updated on 07 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc