### Install and Use Musicard Library Source: https://github.com/kunalkandepatil/musicard/blob/main/readme.md This snippet shows how to install the musicard library using npm and then use it to generate a music card. It initializes fonts, creates a Bloom card with specified track details, and saves it as a PNG file. This is the primary method for generating music cards. ```bash npm install musicard ``` ```javascript import { initializeFonts, Bloom } from 'musicard'; import fs from 'node:fs'; (async () => { initializeFonts(); const musicard = await Bloom({ trackName: "Blinding Lights", artistName: "The Weeknd", albumArt: "", // Image Path/URL isExplicit: true, timeAdjust: { timeStart: "0:00", timeEnd: "2:54", }, progressBar: 10, volumeBar: 70, }); fs.writeFileSync('example.png', musicard); console.log('✅-> example.png'); })(); ``` -------------------------------- ### Install Musicard using npm Source: https://context7.com/kunalkandepatil/musicard/llms.txt Installs the musicard package and its dependencies using npm. This is the first step to using the library in your Node.js project. ```bash npm install musicard ``` -------------------------------- ### Discord Bot Integration with Bloom Theme using JavaScript Source: https://context7.com/kunalkandepatil/musicard/llms.txt Demonstrates how to integrate the Musicard library into a Discord bot to display a 'Now Playing' music card using the Bloom theme. This example uses `require` for importing modules and assumes a Discord.js client is available. It sends the generated card as a file in the channel. ```javascript const { initializeFonts, Bloom } = require("musicard"); // Initialize fonts once when bot starts initializeFonts(); // In your command handler client.on('messageCreate', async (message) => { if (message.content === '!nowplaying') { const card = await Bloom({ trackName: "Currently Playing Track", artistName: "Artist Name", albumArt: "https://example.com/album.jpg", fallbackArt: "https://example.com/default.jpg", progressBar: 50, timeAdjust: { timeStart: "1:30", timeEnd: "3:45" } }); await message.channel.send({ files: [{ attachment: card, name: 'nowplaying.png' }] }); } }); ``` -------------------------------- ### Get Global Registered Fonts in Musicard Source: https://context7.com/kunalkandepatil/musicard/llms.txt Retrieves a comma-separated string of all registered font names for debugging or inspection. Requires default fonts to be initialized. ```javascript import { GlobalFonts, initializeFonts } from 'musicard'; initializeFonts(); console.log(GlobalFonts); // Output: "GoogleSans", sans-serif ``` -------------------------------- ### Get Registered Fonts in Musicard Source: https://github.com/kunalkandepatil/musicard/blob/main/readme.md This JavaScript snippet shows how to retrieve a list of all fonts currently registered and available for use within the musicard library. It imports `GlobalFonts` and logs the object to the console, which can be helpful for debugging or selecting fonts. ```javascript import { GlobalFonts } from 'musicard'; console.log(GlobalFonts); // Prints all registered font names ``` -------------------------------- ### Generate Ease Compact Music Card with Progress and Volume Bars (JavaScript) Source: https://context7.com/kunalkandepatil/musicard/llms.txt Produces a compact horizontal Ease music card with smaller album art, track information, and both progress and volume bars with percentage display. Ideal for space-constrained layouts. Requires 'musicard' package and Node.js 'fs' module. ```javascript import { initializeFonts, Ease } from 'musicard'; import fs from 'node:fs'; (async () => { initializeFonts(); const card = await Ease({ trackName: "Die For You", artistName: "The Weeknd", albumArt: "https://example.com/album.jpg", fallbackArt: "https://example.com/fallback.jpg", isExplicit: false, timeAdjust: { timeStart: "1:30", timeEnd: "4:20" }, progressBar: 35, volumeBar: 80, backgroundColor: "#16213e", styleConfig: { trackStyle: { textColor: "#ffffff", textGlow: false, textItalic: false }, artistStyle: { textColor: "#a0a0a0", textGlow: false, textItalic: true }, timeStyle: { textColor: "#666666", textItalic: false }, progressBarStyle: { barColor: "#00d9ff", barColorDuo: true }, volumeBarStyle: { barColor: "#00d9ff", barColorDuo: false }, explicitStyle: { iconColor: "white", iconOpacity: 48 } } }); fs.writeFileSync('ease-card.png', card); })(); ``` -------------------------------- ### Generate Melt Music Card with Album Art and Progress Bars (JavaScript) Source: https://context7.com/kunalkandepatil/musicard/llms.txt Generates a Melt music card featuring album art on the left, track details on the right, and both horizontal progress and vertical volume bars. It uses a solid background without blur effects. Requires 'musicard' package and Node.js 'fs' module. ```javascript import { initializeFonts, Melt } from 'musicard'; import fs from 'node:fs'; (async () => { initializeFonts(); const card = await Melt({ trackName: "Save Your Tears", artistName: "The Weeknd", albumArt: "https://example.com/album.jpg", fallbackArt: "https://example.com/fallback.jpg", isExplicit: false, timeAdjust: { timeStart: "0:45", timeEnd: "3:35" }, progressBar: 21, volumeBar: 75, backgroundColor: "#1a1a2e", styleConfig: { trackStyle: { textColor: "#ffffff", textGlow: true, textItalic: false }, artistStyle: { textColor: "#b8b8b8", textGlow: false, textItalic: false }, timeStyle: { textColor: "#888888", textItalic: false }, progressBarStyle: { barColor: "#e94560", barColorDuo: false }, volumeBarStyle: { barColor: "#e94560", barColorDuo: false }, explicitStyle: { iconColor: "white", iconOpacity: 50 } } }); fs.writeFileSync('melt-card.png', card); })(); ``` -------------------------------- ### Generate Haze Music Card with Blurred Album Art (JavaScript) Source: https://context7.com/kunalkandepatil/musicard/llms.txt Creates a Haze music card with text aligned left and blurred album art on the right, offering a unique hazy visual effect. It does not display album art as a separate image. Requires 'musicard' package and Node.js 'fs' module. ```javascript import { initializeFonts, Haze } from 'musicard'; import fs from 'node:fs'; (async () => { initializeFonts(); const card = await Haze({ trackName: "Starboy", artistName: "The Weeknd ft. Daft Punk", albumArt: "https://example.com/starboy.jpg", fallbackArt: "https://example.com/default.jpg", isExplicit: true, timeAdjust: { timeStart: "2:15", timeEnd: "3:50" }, progressBar: 60, backgroundColor: "#0f0f23", styleConfig: { trackStyle: { textColor: "#ff6b6b", textGlow: true, textItalic: false }, artistStyle: { textColor: "#c9c9c9", textGlow: false, textItalic: true }, timeStyle: { textColor: "#888888", textItalic: false }, progressBarStyle: { barColor: "#ff6b6b", barColorDuo: true }, explicitStyle: { iconColor: "#ff6b6b", iconOpacity: 70 } } }); fs.writeFileSync('haze-card.png', card); })(); ``` -------------------------------- ### Initialize Default Fonts for Musicard Source: https://context7.com/kunalkandepatil/musicard/llms.txt Initializes the default GoogleSans font required for rendering text on music cards. This function must be called before generating any music card to ensure proper font rendering. ```javascript import { initializeFonts } from 'musicard'; // Initialize fonts before creating any music cards initializeFonts(); ``` -------------------------------- ### Create Drift Music Card with JavaScript Source: https://context7.com/kunalkandepatil/musicard/llms.txt Generates a music card with horizontally stretched album art and an overlay for track information. This theme features a compact design with blurred background effects and supports explicit content badges. Requires 'musicard' and 'node:fs' packages. ```javascript import { initializeFonts, Drift } from 'musicard'; import fs from 'node:fs'; (async () => { initializeFonts(); const card = await Drift({ trackName: "After Hours", artistName: "The Weeknd", albumArt: "https://example.com/afterhours.jpg", fallbackArt: "https://example.com/default.jpg", isExplicit: true, timeAdjust: { timeStart: "3:45", timeEnd: "6:01" }, progressBar: 62, backgroundColor: "#2d132c", styleConfig: { trackStyle: { textColor: "#ffd700", textGlow: true, textItalic: false }, artistStyle: { textColor: "#e0e0e0", textGlow: false, textItalic: false }, timeStyle: { textColor: "#999999", textItalic: false }, progressBarStyle: { barColor: "#ffd700", barColorDuo: true }, explicitStyle: { iconColor: "#ffd700", iconOpacity: 60 } } }); fs.writeFileSync('drift-card.png', card); })(); ``` -------------------------------- ### Generate Bloom Theme Music Card Source: https://context7.com/kunalkandepatil/musicard/llms.txt Creates a music card using the Bloom theme, featuring a side-by-side layout with album art and track details. Supports customization of text, progress bar, and explicit content indicators. Outputs a PNG buffer. ```javascript import { initializeFonts, Bloom } from 'musicard'; import fs from 'node:fs'; (async () => { initializeFonts(); const card = await Bloom({ trackName: "Blinding Lights", artistName: "The Weeknd", albumArt: "https://example.com/album-cover.jpg", fallbackArt: "https://example.com/default-cover.jpg", isExplicit: true, timeAdjust: { timeStart: "1:24", timeEnd: "3:20" }, progressBar: 42, backgroundColor: "black", styleConfig: { trackStyle: { textColor: "white", textGlow: true, textItalic: false }, artistStyle: { textColor: "#cccccc", textGlow: false, textItalic: true }, timeStyle: { textColor: "white", textItalic: false }, progressBarStyle: { barColor: "#1DB954", barColorDuo: true }, explicitStyle: { iconColor: "white", iconOpacity: 48 } } }); fs.writeFileSync('bloom-card.png', card); })(); ``` -------------------------------- ### Create Calm Music Card with JavaScript Source: https://context7.com/kunalkandepatil/musicard/llms.txt Generates a centered music card design without visible album art, displaying track name and artist centrally with a minimal aesthetic. This theme does not support explicit content badges. Requires 'musicard' and 'node:fs' packages. ```javascript import { initializeFonts, Calm } from 'musicard'; import fs from 'node:fs'; (async () => { initializeFonts(); const card = await Calm({ trackName: "Call Out My Name", artistName: "The Weeknd", albumArt: "https://example.com/album.jpg", fallbackArt: "https://example.com/fallback.jpg", timeAdjust: { timeStart: "0:00", timeEnd: "3:48" }, progressBar: 15, backgroundColor: "#1f1f38", styleConfig: { trackStyle: { textColor: "#ffffff", textGlow: true, textItalic: false }, artistStyle: { textColor: "#b4b4b4", textGlow: false, textItalic: true }, timeStyle: { textColor: "#777777", textItalic: false }, progressBarStyle: { barColor: "#9b59b6", barColorDuo: false } } }); fs.writeFileSync('calm-card.png', card); })(); ``` -------------------------------- ### Send Musicard in Discord Bot Source: https://github.com/kunalkandepatil/musicard/blob/main/readme.md This JavaScript snippet demonstrates how to integrate musicard into a Discord bot. It shows the necessary imports, initialization of fonts, generation of a musicard using the Bloom function, and sending the generated image as an attachment in a Discord message. This is useful for bots that play music. ```javascript const { initializeFonts, Bloom } = require("musicard"); const fs = require("fs") await initializeFonts(); const musicard = await Bloom({...}) ... // Assuming 'message' is a Discord message object return message.channel.send({ files: [{ attachment: musicard }] }) ``` -------------------------------- ### Register Custom Font for Musicard Source: https://context7.com/kunalkandepatil/musicard/llms.txt Registers a custom font file for use in music card text rendering. The font file should be placed in a `Fonts` folder or specified with an absolute path. Ensure default fonts are initialized first. ```javascript import { registerFont, initializeFonts } from 'musicard'; // First initialize default fonts initializeFonts(); // Register a custom font (place MyCustomFont.ttf in ./Fonts/ directory) registerFont('MyCustomFont.ttf', 'MyCustomFont'); // Now use the custom font in styleConfig when creating cards ``` -------------------------------- ### Customize Musicard Background Color Source: https://github.com/kunalkandepatil/musicard/blob/main/readme.md This JavaScript snippet illustrates how to customize the background color of a music card generated by the musicard library. It shows a simple key-value pair within the configuration object to set the desired background color. ```javascript backgroundColor: "white" ``` -------------------------------- ### Customize Musicard Progress Bar Source: https://github.com/kunalkandepatil/musicard/blob/main/readme.md This JavaScript snippet demonstrates how to customize the appearance of the progress bar on a music card. It uses the `styleConfig` to set the bar color and enable a dual-color effect for the progress bar. ```javascript styleConfig: { progressBarStyle: { barColor: "#000000", barColorDuo: true } } ``` -------------------------------- ### Register Custom Font for Musicard Source: https://github.com/kunalkandepatil/musicard/blob/main/readme.md This JavaScript snippet shows how to register a custom font for use in musicard. It requires importing the `registerFont` function and providing the path to the font file and a name to reference it. Custom fonts should be placed in a 'Fonts' folder in the project root. ```javascript import { registerFont } from 'musicard'; registerFont('MyFont.ttf', 'MyFont'); ``` -------------------------------- ### Customize Musicard Text Style Source: https://github.com/kunalkandepatil/musicard/blob/main/readme.md This JavaScript snippet shows how to customize the text styling for elements like the track name on a music card. It utilizes the `styleConfig` object to modify properties such as text color, glow effect, and italicization. ```javascript styleConfig: { trackStyle: { textColor: "black", textGlow: true, textItalic: true } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.