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

svg-sketchy

v0.1.0-beta.6

Published

CLI to sketch svg

Downloads

9

Readme

Features

  • :pencil2: Converting svgs to hand-drawn style.
  • :four_leaf_clover: Compatible with .dot and .mmd formats.

:point_right: Try it online

Install

$ npm i -g svg-sketchy

Usage

Used as CLI

sketch .svg

$ sket hello_world.svg # sketch single svg and override it
$ sket hello_world.svg -r /home  # sketch svg in another directory
$ sket hello_*.svg # sketch multiple svgs which paths start with "hello_" and override them
$ sket world.svg -o /home/hello_[name].svg # sketch svg and output it to a new directory with a new name "hello_world.svg"

sketch .dot & .mmd

Sketching .dot & .mmd files is not much different than sketching .svg. Suppose we have two files named hello_world.dot and hello_world.mmd, after sketching, the outputs would look like:

||hello_world.dot|hello_world.mmd| |----|:-----:|:-----:| |dsl|digraph G {Hello->World}| graph TB\nhello-->world |cmd|sket hello_world.dot | sket hello_world.mmd |outputs without sketching|dot| |  |  | |outputs after sketching|dot_sketch|

customize sketch style

Try it online to see how different sketch configs affect the final svg output.

CLI options

|option|default|description| |----|----|----| -r, --root <svg_root_dir> | cwd |Svg files root directory, ignored when [svg_files] is absolute. -o, --output <svg_out_file> |"{cwd}/[name].svg"| Svg files output directory and filename, use "[name]" to keep the original svg filename. -f, --font <font_family> |"Comic Sans MS, cursive"| Font with which text elements should be drawn, setting to "null" will use the text element's original font family. --rough <roughjs_config> |-| Rough.js config, see roughjs options. e.g: "roughness=0.5,bowing=5". --no-rand |false| Whether to disable randomize Rough.js' fillWeight, hachureAngle and hachureGap. --no-fill |false|Whether to disable sketch pattern fills/strokes or just copy them to the output. --pencil |false|Whether to apply a pencil effect on the SVG rendering.

Used as API

You can also use svg-sketchy in Node.js env.

import { SVGSketcher } from 'svg-sketchy'

// create a SVGSketcher instance
const sketcher = new SVGSketcher({
  target: 'world.svg',
  root: './', // <--> -r, --root
  output: '/home/hello_[name].svg', // <--> -o, --output
  fontFamily: 'arial', // <--> -f, --font
  roughConfig: { // <--> --rough
    roughness: 0.5,
    bowing: 5
  },
  randomize: false, // <--> --no-rand
  sketchPatterns: false, // <--> --no-fill
  pencilFilter: true, // <--> --pencil
})

// transforming
await sketcher.run()