🪄Util

Util

Kind: global class

new Util()

Canvacard Util

Util.validateHex(hex) ⇒ boolean

Validates hex

Kind: static method of Util

ParamTypeDescription

hex

string

Hex code to validate

Util.discordTime(time) ⇒ string

Converts regular timestamp to discord like time

Kind: static method of Util

ParamTypeDescription

time

Date | number

Timestamp to convert

Util.formatTime(time) ⇒ string

Formats time

Kind: static method of Util

ParamTypeDescription

time

number

Time to format

Util.shorten(text, len) ⇒ string

Shorten text.

Kind: static method of Util

ParamTypeDescription

text

string

Text to shorten

len

number

Max Length

Util.toAbbrev(num) ⇒ string | string

Converts numbers into units like 1K, 1M, 1B etc.

Kind: static method of Util

ParamType

num

number | string

Util.renderEmoji(ctx, msg, x, y) ⇒ Promise.<void>

Renders text with emoji

Kind: static method of Util

ParamTypeDescription

ctx

CanvasRenderingContext2D

CanvasRenderingContext2D

msg

string

Message

x

number

X

y

number

Y

Util.formatHex(hex, alt) ⇒ string

Returns formatted hex code

Kind: static method of Util

ParamTypeDefaultDescription

hex

string

Hex code to format

alt

string

"#000000"

Alt color

Util.invertColor(hex) ⇒ string

Inverts hex color

Kind: static method of Util

ParamTypeDescription

hex

string

Hex color code to invert

Util.getAcronym(name) ⇒ string

Returns acronym

Kind: static method of Util

ParamTypeDescription

name

string

Name to parse acronym

Util.getLines(params, text, ctx, maxWidth) ⇒ Array.<string>

Returns array of lines

Kind: static method of Util

ParamTypeDescription

params

object

Params

text

string

Text

ctx

CanvasRenderingContext2D

CanvasRenderingContext2D

maxWidth

number

Max width

Last updated