Skip to content

ZarScape/zarcanvas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ZarCanvas 🎨

zarcanvas-banner

NPM Version License: ISC Node.js Discord GitHub NPM Downloads


ZarCanvas

ZarCanvas is a native canvas library for creating modern, visually clean cards. Optimized for social media simulation and music player visuals.


πŸš€ Installation

npm install zarcanvas

πŸ› οΈ Usage Examples

1. Music Card

Perfect for "Now Playing" visuals with gradient support.

Full Version (With Progress)

music-card

import { MusicCard } from 'zarcanvas';
import fs from 'node:fs';

const card = new MusicCard({
  trackName: 'MONTAGEM ZAR',
  artistName: 'ZarScape',
  albumArt: 'https://raw.githubusercontent.com/ZarScape/ZarScape/refs/heads/main/images/ZarScape/logo-with-background.png',
  backgroundColor: '#082131ff',
  gradientColor: '#467ca0ff',
  progressBar: 75,
  progressTime: '2:30 / 3:12',
  trackNameColor: '#bacfddff',
  artistNameColor: '#abc2d1ff',
  progressTimeColor: '#9cb4c4ff',
  progressBarColor: ['#2a4a5aff', '#68b3d8']
});

const buffer = await card.build();
fs.writeFileSync('music_full.png', buffer);

Minimal Version (No Progress)

minimal-music-card

const minimalCard = new MusicCard({
  trackName: 'MONTAGEM ZAR',
  artistName: 'ZarScape',
  albumArt: 'https://raw.githubusercontent.com/ZarScape/ZarScape/refs/heads/main/images/ZarScape/logo-with-background.png',
  backgroundColor: '#082131ff',
  gradientColor: '#467ca0ff',
  trackNameColor: '#bacfddff',
  artistNameColor: '#abc2d1ff'
});

const buffer = await minimalCard.build();
fs.writeFileSync('music_minimal.png', buffer);

2. Profile Card

Designer profile card with background blur and frame effects.

profile-card

import { ProfileCard } from 'zarcanvas';

const card = new ProfileCard({
  avatarURL: 'https://raw.githubusercontent.com/ZarScape/ZarScape/refs/heads/main/images/ZarScape/logo-with-background.png',
  decorationURL: 'https://cdn.discordapp.com/avatar-decoration-presets/a_64c339e0c128dcb279ae201b1190d9d3.png',
  backgroundURL: 'https://raw.githubusercontent.com/ZarScape/ZarScape/refs/heads/main/images/ZarScape/banner-with-text.png',
  userName: 'zarscape',
  userDisplayname: 'ZarScape',
  backgroundBlur: 20,
  usernameColor: '#b8e7ff',
  borderColor: ['#60a5c7', '#193542ff']
});

const buffer = await card.build();

3. Instagram Card

Authentic Instagram post simulation.

muinstagram-card

import { InstagramCard } from 'zarcanvas';

const card = new InstagramCard({
  username: "ZarScape",
  avatar: "https://raw.githubusercontent.com/ZarScape/ZarScape/refs/heads/main/images/ZarScape/logo-with-background.png",
  postImage: "https://raw.githubusercontent.com/ZarScape/ZarScape/refs/heads/main/images/ZarScape/logo-with-background.png",
  likeCount: 125000,
  verified: true,
  postDate: new Date(Date.now() - 86400000)
});

const buffer = await card.generate();

4. Tweet (X) Card

Native X/Twitter post simulation using Chirp fonts.

tweet-card

import { TweetCard } from 'zarcanvas';

const card = new TweetCard({
  user: { 
    displayName: 'Muhammad Abuzar', 
    username: 'zarscape' 
  },
  message: 'Testing X (tweet) card using ZarCanvas. Looks awesome! #ZarCanvas #Design #ZarScape',
  verified: true,
  stats: {
    replies: 124,
    retweets: 850,
    likes: '12K',
    views: '250K'
  }
});

const buffer = await card.build();

5. Ship Card

Compare two profiles with a love percentage and themed icons.

ship-card

import { ShipCard } from 'zarcanvas';

const card = new ShipCard()
  .setAvatar1('https://raw.githubusercontent.com/ZarScape/ZarScape/refs/heads/main/images/ZarScape/logo-with-background.png')
  .setAvatar2('https://raw.githubusercontent.com/ZarScape/ZarScape/refs/heads/main/images/ZarScape/logo-with-background.png')
  .setPercentage(95);

const buffer = await card.build();

πŸ“¦ API Reference

Music Card (MusicCardOptions)

Property Type Required Description Default
trackName string βœ… Title of the track. -
artistName string βœ… Name of the artist. -
albumArt string βœ… URL or path to artwork. -
backgroundColor string βœ… Background hex/CSS color. -
gradientColor string βœ… Color for decorative glow. -
trackNameColor string ❌ Track title hex color. #000000
artistNameColor string ❌ Artist name hex color. #555555
progressBar number ❌ Percentage (0-100). undefined
progressBarColor string | string[] ❌ Solid or gradient color. #000000
progressTime string ❌ Time text (e.g. "2:30 / 4:00"). undefined

Profile Card (ProfileCardOptions)

Property Type Required Description Default
avatarURL string βœ… Main profile avatar URL. -
userName string βœ… The handle/username (with @). -
userDisplayname string ❌ Large display title. userName
backgroundBlur number ❌ Blur intensity (0-100). 20
usernameColor string ❌ Hex color for the title. #b8e7ff
borderColor string | string[] ❌ Solid or gradient border. undefined
squareAvatar boolean ❌ Use square instead of circle avatar. false

Instagram Card (InstagramCardOptions)

Property Type Required Description Default
username string βœ… Instagram handle. -
avatar string βœ… Profile image URL. -
postImage string βœ… Main post content image URL. -
likeCount number βœ… Total number of likes. -
verified boolean ❌ Shows blue verified badge. true
postDate Date | number ❌ Date of the post. Date.now()

X (Tweet) Card (TweetCardOptions)

Property Type Required Description Default
user object βœ… { displayName: string, username: string } -
message string βœ… The tweet content text. -
stats object βœ… { replies, retweets, likes, views } -
verified boolean ❌ Shows blue checkmark badge. true
timestamp string ❌ Relative time (e.g. "1h"). 1h
avatar string ❌ Profile image URL. ZarScape Logo

Ship Card (ShipCardOptions)

Property Type Required Description Default
avatar1 string βœ… First user avatar URL. -
avatar2 string βœ… Second user avatar URL. -
percentage number βœ… Love percentage (0-100). -
background string ❌ Background image URL. Default Gradient
font string ❌ Custom font family name. Plus Jakarta Sans

πŸ›‘οΈ Guide & Tips

Best Visual Results

  • Images: Use high-resolution square images for avatars to prevent stretching or warping.
  • Gradients: For properties accepting string[], providing 2-3 hex codes creates a smooth professional linear transition.
  • Async Handling: All card generation methods are asynchronous. Always use await when calling .build() or .generate()..

πŸ“œ License

ISC Β© Muhammad Abuzar (ZarScape)