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

@s9a/dab

v0.3.0

Published

Create PNG image in any color

Downloads

5

Readme

dab

  • Create images in any color
  • Convert image filetypes
  • Resize images

node usage

npm install @s9a/dab
const dab = require("@s9a/dab")
dab(deets, callback=dab.terse)

deets

properties

  • from is a filename or color format
    • Default is "#dab"
    • Supports png gif tif jpg webp svg
    • Supports hexes and named colors or rgb hsl with commas
  • to is the filename to save to
    • Default is like [from]_[shape].png
    • Supports png tif jpg webp
  • shape is desired dimensions in pixels
    • Supports wtb formats
    • Default is 960 aka "960" aka "960x960" aka [960, 960]

create png from color

dab({
  from: "#bae",
  to: "bae.png",
  shape: "1280x640",
})

convert jpg to webp

dab({
  from: "foto.jpg",
  to: "foto.webp",
  shape: "1280x640",
})

callback

  • callback may be custom or preset
  • callback defaults to dab.terse
dab({})
dab({}, dab.verbose)
dab({}, (err, did) => {
  if (err) throw err
  console.log(did)
})

callback presets

  • dab.verbose verbose info
  • dab.terse terse info
  • dab.quiet only warnings or errors
  • dab.silent nothing

CLI

syntax

dab [from] [to] [shape]
  • supports the same properties as the node syntax
  • from can be a filename or color format
  • to can be a filename
  • shape Dimension syntax is widthxheight or just width for square

hexes

  • Good: "#000" '#000' \#000 "rgb(0, 0, 0)" "black" 'black' black
  • Fails: #000 rgb(0, 0, 0)
  • CLI sees # as comment if seen without quotes or backslash
  • CLI honors alphabet hexes like #bed as bed as shorthand but not like b3d

flags

  • --help
  • --silent
  • --quiet
  • --terse default
  • --verbose

node npm npx

node installers provide node npm npx

versions are checkable via your command line

node -v
npm -v
npx -v

CLI examples

temporary

  • npx lets you dab on the fly with the scoped package name @s9a/dab
  • Easy way to try dab without saving the package
npx @s9a/dab "#dab" dab.png 1280
npx @s9a/dab "#dab" dab.png 1280x640
npx @s9a/dab "lime" 1280
npx @s9a/dab "lime" 1280x640
npx @s9a/dab "rgb(0, 255, 0)" 1280x640

project

  • You can save @s9a/dab as a project dependency
  • Recommended when you wanna dab in a project
  • First create package.json via npm init or manually
npm install @s9a/dab
npx dab "#dab" dab.png 1280
npx dab "#dab" dab.png 1280x640
npx dab "lime" 1280
npx dab "lime" 1280x640
npx dab "rgb(0, 255, 0)" 1280x640

clone

  • Cloning the repo is another way to dab
  • This'll create a folder where you can dab
git clone [email protected]:s9a/dab.git #team
git clone https://github.com/s9a/dab.git #guest
cd dab
npm install
npm test
npx . "#dab" dab.png 1280
npx . "#dab" dab.png 1280x640
npx . "lime" 1280
npx . "lime" 1280x640
npx . "rgb(0, 255, 0)" 1280x640

global

  • This is how to install dab as global command
  • Recommended when you wanna dab anywhere and have access
  • May need --unsafe-perm to build dependencies
npm install @s9a/dab --global #admin
sudo npm install @s9a/dab --global #user
dab "#dab" dab.png 1280
dab "#dab" dab.png 1280x640
dab "lime" 1280
dab "lime" 1280x640
dab "rgb(0, 255, 0)" 1280x640

uninstall whenever

npm uninstall @s9a/dab --global