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

@jimf/colortools

v0.2.1

Published

Command-line tool for working with colors

Downloads

4

Readme

npm Version Build Status

colortools

Command-line tool for working with colors.

Work in progress

screenshot

Installation

Prerequisites: NodeJS >=12.0.0

Install with npm:

npm install @jimf/colortools --global

The --global flag is optional, but recommended.

Once installed, this package provides a color bin script. Be sure to add this to your $PATH, or run with npx color.

Usage

color exposes a number of sub-commands for working with colors. For an overview of the available sub-commands, run:

color help

For additional information on a given sub-command, append the sub-command name. For example, to view the help on the show sub-command:

color help show

Available Commands

show

show is likely to be the most used command from this tool. Like the name hopefully suggests, it can be used to show information on colors. For each color specified, it will output a color swatch, as well as the hex, RGB, and HSL formats of that color. Additionally, if any colors have been added to the color configuration (see the config command), the output will show if the color matches or is similar to any config colors.

Examples:

color show c0ffee          # Base command, single color
color show '#c0ffee'       # Quotes needed to use # (shell comment)
color show 0,0,0           # RGB (NO SPACES)
color show 'rgb(0, 0, 0)'  # Quotes needed to include spaces
color show c0ffee 000000   # Any number of colors may be specified

The next set of examples assume a color palette has been configured:

color show blue-500        # Show color info on a config color
color show red-50 blue-50  # Again, multiple colors supported
color show red-50 000000   # Config and regular colors can be mixed
color show 'blue-*'        # Glob to match multiple config colors

See color help show for additional usage information.

config

config can be used to create, read, update, and delete your preferences for this tool. Currently this only includes color data, but other preferences will likely be added in the future.

config overview:

color config set <key> <value>    # Set a config value
color config get <key>            # Get a config value
color config delete <key>         # Delete a config value
color config list                 # List config values

For working with colors, use the colors top-level key. For example, the following will define blue-500:

color config set colors.blue-500 3B82F6

Values will be run through the color parser, so any valid color format may be used for the values; not just hex.

Namespaces may be used to work with multiple color palettes. For example:

color config set colors.tailwind:blue-500 3B82F6

There is nothing special with regard to this <namespace>: syntax. It's purely a convention I use. The keys themselves are just strings.

colortools adheres to the XDG Base Directory Specification, storing configuration data to ~/.config/@jimf/colortools/config.json, where the ~/.config portion can be overridden with the XDG_CONFIG_HOME environment variable. Data is stored in JSON format, but this is an implementation detail that should not be relied upon. Prefer the color config command for configuration CRUD.

Motivation

My primary motivation with this tool was to solve workflow issues I regularly run into while turning design comps into actual code. Great comps strictly adhere to a color palette, and provide color variables directly. However, if I'm just working off of a screen grab, or raw hex codes, etc., it can be time consuming to translate color variables into their palette equivalents, particularly if the colors are close but not perfect. With this tool, I can take these raw color values and very quickly translate them to the palettes I work with.

License

MIT