npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

char-renderer-ss13

v1.2.0

Published

Space Station 13 character renderer for Node.js - renders SS13 characters from preferences to PNG images

Downloads

453

Readme

char-renderer-ss13

Space Station 13 character renderer for Node.js

Target codebase: TGStation and downstream NovaStation > The Fluffy Frontier;

Renders SS13 characters from preferences JSON to PNG images with full support for:

  • Multiple species (Human, Lizard, Moth, Mammal, Skrell, IPC/Synth, Plasmaman, etc.)
  • Hairstyles with gradient support
  • Facial hair with gradient support
  • Skrell tentacle hair (separate system)
  • Body markings
  • Accessories (tails, ears, horns, snouts, wings)
  • Augmentations/robotic limbs (all IPC chassis styles)
  • IPC antennas
  • Digitigrade legs
  • All 4 directions (SOUTH, NORTH, EAST, WEST)
  • Transparent background by default (or custom color/image)

Installation

npm install char-renderer-ss13

Requirements

  • Node.js >= 16.0.0
  • The package uses @napi-rs/canvas which is automatically installed as a dependency

Usage

Basic Example

const { renderCharacterToPNG } = require('char-renderer-ss13');

const characterPrefs = {
    real_name: "John Doe",
    species: "human",
    age: 30,
    gender: "male",
    body_type: "male",
    skin_tone: "caucasian1",
    eye_color: "#0066cc",
    hairstyle_name: "Short Hair",
    hair_color: "#000000",
    facial_style_name: "Shaved",
    // ... other preferences
};

// Render with transparent background (default)
const pngBuffer = await renderCharacterToPNG(characterPrefs);

// Save to file
const fs = require('fs');
fs.writeFileSync('character.png', pngBuffer);

Background Options

// Transparent background (default)
const png = await renderCharacterToPNG(prefs, 0);

// Solid color background
const png = await renderCharacterToPNG(prefs, 0, { color: '#333333' });

// Image background (scales to fit)
const bgImage = fs.readFileSync('background.png');
const png = await renderCharacterToPNG(prefs, 0, { image: bgImage });

Render All Directions

const { renderCharacterAllDirections } = require('char-renderer-ss13');

// With transparent background
const images = await renderCharacterAllDirections(characterPrefs);

// With custom background
const images = await renderCharacterAllDirections(characterPrefs, { color: '#222222' });

// images contains: { south, north, east, west }
fs.writeFileSync('south.png', images.south);
fs.writeFileSync('north.png', images.north);
fs.writeFileSync('east.png', images.east);
fs.writeFileSync('west.png', images.west);

Direction Constants

// 0 = SOUTH (default, facing down)
// 1 = NORTH (facing up)
// 2 = EAST (facing right)
// 3 = WEST (facing left)

const pngBuffer = await renderCharacterToPNG(characterPrefs, 2); // Facing EAST

Discord Bot Example

const { Client, GatewayIntentBits, AttachmentBuilder } = require('discord.js');
const { renderCharacterToPNG } = require('char-renderer-ss13');

const client = new Client({
    intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]
});

client.on('messageCreate', async (message) => {
    if (message.content === '!render') {
        // Load character preferences from your database/file
        const prefs = loadCharacterPreferences();

        // Render character with custom background
        const pngBuffer = await renderCharacterToPNG(prefs, 0, { color: '#1a1a2e' });

        // Send to Discord
        const attachment = new AttachmentBuilder(pngBuffer, {
            name: `${prefs.real_name}.png`
        });

        await message.reply({
            content: `Character: ${prefs.real_name}`,
            files: [attachment]
        });
    }
});

client.login('YOUR_BOT_TOKEN');

Character Preferences Structure

interface CharacterPreferences {
    real_name: string;
    species?: string;              // 'human', 'lizard', 'moth', 'mammal', 'skrell', 'ipc', 'synth', etc.
    age: number;
    gender?: string;               // 'male', 'female', 'plural'
    body_type: string;             // 'male', 'female', 'Use Gender'
    skin_tone: string;             // 'caucasian1', 'caucasian2', 'asian1', etc.
    eye_color: string;             // Hex color with #
    hairstyle_name: string;        // Hair style name from SS13
    hair_color?: string;           // Hex color
    hair_gradient?: string;        // Gradient type: 'Fade Up', 'Fade Down', 'Vertical Split', etc.
    hair_gradient_color?: string;  // Gradient color
    facial_style_name: string;     // 'Shaved', 'Beard', etc.
    facial_hair_color?: string;    // Hex color
    facial_hair_gradient?: string;
    facial_hair_gradient_color?: string;

    // For non-human species
    mutant_colors_color?: string[];
    mutant_bodyparts?: {
        legs?: { name?: string; color?: string[] };
        skrell_hair?: { name?: string; color?: string[] };
        [key: string]: any;
    };

    // Skrell specific
    feature_skrell_hair?: string;  // 'Short', 'Long', etc.
    skrell_hair_toggle?: number;
    skrell_hair_color?: string[];

    // IPC/Synth specific
    feature_ipc_chassis?: string;  // 'Bishop Cyberkinetics', 'Zeng-Hu Pharmaceuticals', etc.
    feature_ipc_head?: string;
    feature_ipc_antenna?: string;  // 'Angled Antennae', 'TV Antennae', etc.
    ipc_antenna_color?: string[];

    // Augmentations
    augments?: {
        [slot: string]: string;    // 'Left Leg': '/obj/item/bodypart/leg/left/robot/weak'
    };
    augment_limb_styles?: {
        [slot: string]: string;    // 'Left Leg': 'Mariinsky Ballet Company'
    };

    // Accessories
    feature_tail?: string;
    tail_color?: string[];
    tail_toggle?: number;          // 0 = hidden, 1 = shown

    feature_snout?: string;
    snout_color?: string[];
    snout_toggle?: number;

    feature_ears?: string;
    ears_color?: string[];
    ears_toggle?: number;

    feature_horns?: string;
    horns_color?: string[];
    horns_toggle?: number;

    // Digitigrade legs
    digitigrade_legs?: string;     // 'Digitigrade Legs'

    // Body markings
    body_markings?: {
        [bodypart: string]: {      // 'head', 'chest', 'l_arm', 'r_arm', etc.
            [markingName: string]: [string, number];  // [color, alpha]
        };
    };
}

interface BackgroundOptions {
    color?: string;   // Hex color like '#ff0000'
    image?: Buffer;   // PNG/JPG buffer - scales to fit
}

Supported Species

  • Human, Felinid, Hemophage
  • Lizard, Synthliz
  • Moth
  • Mammal, Synthmammal, Vulpkanin
  • Skrell (with tentacle hair)
  • IPC/Synth (full robotic body)
  • Plasmaman (with envirosuit)
  • Akula, Aquatic
  • Insect, Insectoid
  • Vox
  • Teshari, Nabber (simple sprites)
  • And more...

Supported Augmentation Styles

  • Cyborg, Surplus, Engineering, Mining, Security
  • Bishop Cyberkinetics (1.0 & 2.0)
  • Morpheus Cyberkinetics
  • Hephaestus Industries (1.0 & 2.0)
  • Shellguard Munitions Standard Series
  • Ward-Takahashi Manufacturing
  • Xion Manufacturing Group (1.0 & 2.0)
  • Zeng-Hu Pharmaceuticals
  • Mariinsky Ballet Company
  • Zhenkov & Co. Foundries
  • E3N AI

Output

  • Image format: PNG (with alpha channel)
  • Dimensions: 256x256 pixels (32x32 upscaled 8x with crisp pixel art)
  • Background: Transparent by default (customizable)
  • Pixel-perfect rendering with no smoothing

Performance

  • First render: ~100-300ms (includes sprite loading and caching)
  • Subsequent renders: ~50-100ms (sprites cached in memory)
  • DMI sprites are cached automatically for better performance

Changelog

1.1.5

  • Transparent background by default
  • Added BackgroundOptions - set solid color or image as background
  • Skrell tentacle hair support (feature_skrell_hair, skrell_hair.dmi)
  • IPC/Synth antenna rendering
  • Hand inherits augmentation style from arm automatically
  • Added base lizard snouts (Sharp, Round, Sharp + Light, Round + Light)
  • Added synthliz snouts

1.1.0

  • Hair and facial hair gradient support
  • IPC/Synth species rendering
  • Full augmentation system
  • Digitigrade legs support

1.0.0

  • Initial release

License

MIT

Credits

Character sprites and assets are from Space Station 13: