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 🙏

© 2024 – Pkg Stats / Ryan Hefner

scarbon

v1.0.9

Published

> Scarbon (Scuffed Carbon) is an elegant code renderer based off [Carbon](https://carbon.now.sh/) built 100% locally. Scarbon made using [Shiki](https://shiki.matsu.io/) for highlighting, [Prettier](https://prettier.io/) for formatting, and [Canvas](https

Downloads

31

Readme

Scarbon (Scuffed Carbon) is an elegant code renderer based off Carbon built 100% locally. Scarbon made using Shiki for highlighting, Prettier for formatting, and Canvas for rendering.

Banner

Example

The below snippet creates a render of itself

const Scarbon = require("scarbon");
const fs = require("fs");

(async () => {
  const render = await new Scarbon({
    theme: "Min Dark", // One of the default themes (Full list below)
    base: "transparent", // Color behind the codeblock
    width: 2048, // Set the width of the image
    radius: 32 // Set the radius of the codeblock corner
  });

  const code = fs.readFileSync(__filename, "utf8"); // Get current file contents
  const output = render.pretty(code); // Get file buffer

  fs.writeFileSync("code.png", output); // Write buffer to file
})();

Output image (code.png) Output

Documentation

Methods

const Scarbon= require("scarbon")

Scarbon.list() // List of registered themes to load by name
Scarbon.register(theme) // Register a theme to load by name
new Scarbon(options) // { Promise } => Renderer (below)

Renderer (class)

{
	png(code, options)
	svg(code, options)
	pretty(code, options)
}

Theme (string, object) The theme to use, can be a registered theme name, a URL to a VSCode theme JSON, a path to a VSCode theme JSON file, VScode theme object

Code (string) The text to format (Should match the language, and formatter parser if provided)

Options (object) Option|Description|Type|Default|Availability :---|:----:|:----:|:----:|---: formatter|Options for Prettier|formatOptions|formatOptions|all background|Background color for the codeblock|color string|theme background|all padding|Amount of padding to add (8 => 1/8 of width)|number|8|pretty width|Width of output image in pixels|number|1200|pretty, png radius|Radius of the codeblock background corners|number|16|all size|Size of the code font|number|24|all font|Font to use for the code (Experimental)|string|Consolas|all base|Color behind code block|color string|xs #ABB8C3|pretty lang|Language to highlight in|language string|javascript|all theme|Theme to use|theme|nord|constructor

formatOptions (object) Option|Description|Type|Default :---|:----:|:----:|---: format|Engine for language formatting|string|babel trailingComma|Whether to add a comma to the end of objects|string (all, none, es5)|none tab|Indent size|number|2 length|Max length before wrapping text|number|80 bracketSpacing|Whether to add space in between {}|boolean|true semicolon|Whether to add semicolons to the end of lines|boolean|true singleQuote|Whether to use ' on strings instead of "|boolean|false disabled|Whether to disable the formatter all together|boolean|false

Default Theme List

  • 3024 Night
  • A11y Dark
  • Base 16 Dark
  • Base 16 Light
  • Blackboard
  • Cobalt
  • Dracula
  • DuoTone Earth
  • DuoTone Forest
  • DuoTone Sea
  • DuoTone Sky
  • DuoTone Space
  • Github Dark
  • Github Light
  • Hopscoth
  • light-plus
  • Lucario
  • Material Darker
  • Material Default
  • Material Lighter
  • Material Ocean
  • Material Palenight
  • Min Dark
  • Min Light
  • Monokai
  • Night Owl Italics
  • Night Owl
  • Nord
  • Oceanic Next
  • One Dark
  • One Light
  • Panda
  • Paraiso Dark
  • Paraiso Light
  • Seti
  • Shades of Purple Italics
  • Shades of Purple
  • Slack Dark
  • Slack Ochin
  • Solarized Dark
  • Solarized Light
  • Synthwave 84
  • Twilight
  • Verminal
  • VS Code
  • Zenburn