Skip to content

Commit

Permalink
Fixed type error and added cutom background example.
Browse files Browse the repository at this point in the history
  • Loading branch information
flameface committed Mar 21, 2024
1 parent 1416631 commit 845079f
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "musicard",
"version": "2.0.4",
"version": "2.0.5",
"description": "Musicard is one of the best canvas libraries to create a variety of music cards.",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -22,7 +22,7 @@
"deploy": "npm publish",
"deploy:beta": "npm publish --tag beta",
"test:m": "cd tests && node index.mjs",
"test:c": "cd tests && node --watch index.js"
"test:c": "cd tests && node index.js"
},
"keywords": [
"musicard",
Expand Down
21 changes: 21 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,27 @@ return message.channel.send({
})
```

## Custom Background (New)
Use a custom image background and also adjust the darkness of the image.
```js
import { Classic } from "musicard";
import fs from 'fs'

Classic({
thumbnailImage: "https://cdn.discordapp.com/attachments/1220001571228880917/1220001571690123284/01.png?ex=660d5a01&is=65fae501&hm=a8cfb44844e61aa0fd01767cd363af048df28966c30d7b04a59f27fa45cf69c4&",
backgroundImage: "https://cdn.discordapp.com/attachments/1220001571228880917/1220001571690123284/01.png?ex=660d5a01&is=65fae501&hm=a8cfb44844e61aa0fd01767cd363af048df28966c30d7b04a59f27fa45cf69c4&",
imageDarkness: 60,
nameColor: "#DC92FF",
progressColor: "#DC92FF",
progressBarColor: "#2B2B2B",
progress: 50
}).then(x => {
fs.writeFileSync("output.png", x)
})
```

![custom](https://ik.imagekit.io/unburn/custom-output.png?updatedAt=1710995171966)

# Themes
Musicard is the #1 canvas library to create music cards with awesome themes.

Expand Down
10 changes: 9 additions & 1 deletion tests/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
const { Classic } = require("musicard");
const fs = require('fs')

Classic({}).then(x => {
Classic({
thumbnailImage: "https://cdn.discordapp.com/attachments/1220001571228880917/1220001571690123284/01.png?ex=660d5a01&is=65fae501&hm=a8cfb44844e61aa0fd01767cd363af048df28966c30d7b04a59f27fa45cf69c4&",
backgroundImage: "https://cdn.discordapp.com/attachments/1220001571228880917/1220001571690123284/01.png?ex=660d5a01&is=65fae501&hm=a8cfb44844e61aa0fd01767cd363af048df28966c30d7b04a59f27fa45cf69c4&",
imageDarkness: 60,
nameColor: "#DC92FF",
progressColor: "#DC92FF",
progressBarColor: "#2B2B2B",
progress: 50
}).then(x => {
fs.writeFileSync("output.png", x)
})
14 changes: 14 additions & 0 deletions tests/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Classic } from "musicard";
import fs from 'fs'

Classic({
thumbnailImage: "https://cdn.discordapp.com/attachments/1220001571228880917/1220001571690123284/01.png?ex=660d5a01&is=65fae501&hm=a8cfb44844e61aa0fd01767cd363af048df28966c30d7b04a59f27fa45cf69c4&",
backgroundImage: "https://cdn.discordapp.com/attachments/1220001571228880917/1220001571690123284/01.png?ex=660d5a01&is=65fae501&hm=a8cfb44844e61aa0fd01767cd363af048df28966c30d7b04a59f27fa45cf69c4&",
imageDarkness: 60,
nameColor: "#DC92FF",
progressColor: "#DC92FF",
progressBarColor: "#2B2B2B",
progress: 50
}).then(x => {
fs.writeFileSync("output.png", x)
})
Binary file modified tests/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"compilerOptions": {
"target": "ES2016",
"module": "CommonJS",
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true,
"outDir": "dist",
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export default defineConfig({
dts: true,
shims: true,
skipNodeModulesBundle: true,
clean: ['./src/index.ts']
clean: true
});

0 comments on commit 845079f

Please sign in to comment.