canvacord
Advanced tools
Comparing version 5.0.5 to 5.0.6
{ | ||
"name": "canvacord", | ||
"version": "5.0.5", | ||
"version": "5.0.6", | ||
"description": "Powerful image manipulation package for beginners.", | ||
@@ -35,3 +35,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"canvacord-assets": "^1.1.0", | ||
"@canvacord/assets": "^1.0.0", | ||
"canvas": "^2.6.1", | ||
@@ -38,0 +38,0 @@ "gifencoder": "^2.0.1", |
@@ -17,2 +17,11 @@ const moment = require("moment"); | ||
/** | ||
* Validates hex | ||
* @param {string} hex Hex code to validate | ||
*/ | ||
static validateHex(hex) { | ||
if (!hex || typeof hex !== "string") return false; | ||
return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(hex); | ||
} | ||
/** | ||
* Converts regular timestamp to discord like time | ||
@@ -19,0 +28,0 @@ * @param {Date|number} time Timestamp to convert |
@@ -1,2 +0,2 @@ | ||
const assets = require("canvacord-assets"); | ||
const assets = require("@canvacord/assets"); | ||
@@ -3,0 +3,0 @@ /** |
@@ -870,9 +870,11 @@ const Trigger = require("../libs/Trigger"); | ||
* @param {string} colorTo Ending color | ||
* @param {number} width Image width | ||
* @param {number} height Image height | ||
* @returns {Buffer} | ||
*/ | ||
static gradient(colorFrom, colorTo) { | ||
static gradient(colorFrom, colorTo, width, height) { | ||
if (!colorFrom) throw new Error("ColorFrom was not provided!"); | ||
if (!colorTo) throw new Error("ColorTo was not provided!"); | ||
const canvas = Canvas.createCanvas(400, 200); | ||
const canvas = Canvas.createCanvas(width || 400, height || 200); | ||
const ctx = canvas.getContext("2d"); | ||
@@ -879,0 +881,0 @@ const gradient = ctx.createLinearGradient(0, 0, canvas.width, 0); |
@@ -261,2 +261,28 @@ const Canvas = require("canvas"); | ||
/** | ||
* Set rank display color | ||
* @param {string} text text color | ||
* @param {string} number Number color | ||
*/ | ||
setRankColor(text = "#FFFFFF", number = "#FFFFFF") { | ||
if (!text || typeof text !== "string") text = "#FFFFFF"; | ||
if (!number || typeof number !== "string") number = "#FFFFFF"; | ||
this.data.rank.textColor = text; | ||
this.data.rank.color = number; | ||
return this; | ||
} | ||
/** | ||
* Set level color | ||
* @param {string} text text color | ||
* @param {string} number number color | ||
*/ | ||
setLevelColor(text = "#FFFFFF", number = "#FFFFFF") { | ||
if (!text || typeof text !== "string") text = "#FFFFFF"; | ||
if (!number || typeof number !== "string") number = "#FFFFFF"; | ||
this.data.level.textColor = text; | ||
this.data.level.color = number; | ||
return this; | ||
} | ||
/** | ||
* Set Level | ||
@@ -278,2 +304,12 @@ * @param {number} data Current Level | ||
/** | ||
* Set custom status color | ||
* @param {string} color Color to set | ||
*/ | ||
setCustomStatusColor(color) { | ||
if (!color || typeof color !== "string") throw new Error("Invalid color!"); | ||
this.data.status.color = color; | ||
return this; | ||
} | ||
/** | ||
* Set status | ||
@@ -393,3 +429,3 @@ * @param {"online"|"idle"|"dnd"|"offline"|"streaming"} status User status | ||
ctx.textAlign = "start"; | ||
const name = Util.shorten(this.data.username.name, 12); | ||
const name = Util.shorten(this.data.username.name, 10); | ||
@@ -396,0 +432,0 @@ // apply username |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137406
2510
+ Added@canvacord/assets@^1.0.0
+ Added@canvacord/assets@1.0.2(transitive)
- Removedcanvacord-assets@^1.1.0
- Removedcanvacord-assets@1.1.0(transitive)