UNPKG

discord-card-canvas

Version:

👾 Simple creating cards using canvas. Welcome, Rank, Info and so on.

44 lines (43 loc) • 1.78 kB
import { Canvas, CanvasRenderingContext2D } from 'canvas'; import { BackgroundBaseColor, BorderStyle, Color, TextCard } from '../../interface/card.interface'; export interface BaseCardParams { mainText?: TextCard; nicknameText?: TextCard; secondText?: TextCard; backgroundColor?: BackgroundBaseColor; backgroundImgURL?: string; avatarImgURL?: string; avatarBorderColor?: Color; avatarBorderStyle?: BorderStyle; fontDefault?: string; colorTextDefault?: Color; } type OptionsDraw = { only?: string[]; objectFit?: 'fill' | 'cover'; }; export declare class BaseCardBuilder { mainText?: TextCard; nicknameText?: TextCard; secondText?: TextCard; backgroundImgURL?: string; backgroundColor: BackgroundBaseColor; avatarBorderStyle?: BorderStyle; avatarImgURL?: string; avatarBorderColor: Color; fontDefault: string; colorTextDefault: Color; constructor({ mainText, nicknameText, secondText, backgroundImgURL, backgroundColor, avatarBorderStyle, avatarImgURL, avatarBorderColor, fontDefault, colorTextDefault, }?: BaseCardParams); setBackgroundColor(backgroundColor: BackgroundBaseColor): this; setBackgroundImgURL(backgroundImgURL: string): this; setAvatarImgURL(avatarImgURL: string): this; setAvatarBorderColor(avatarBorderColor: Color): this; setFontDefault(fontDefault: string): this; setColorTextDefault(colorTextDefault: Color): this; setMainText(mainText: TextCard): this; setNicknameText(nicknameText: TextCard): this; setSecondText(secondText: TextCard): this; draw(ctx: CanvasRenderingContext2D, canvasWidth: number, canvasHeight: number, options?: OptionsDraw): Promise<void>; build(options?: OptionsDraw): Promise<Canvas>; } export {};