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

termcolors

v0.7.3

Published

Convert color schemes to multiple terminal configs

Downloads

66

Readme

TermColors

Import and export between multiple terminal colour scheme formats

Many templates are sourced from the Base16-Builder.

Colors are handled using Colr.

Installation

npm install termcolors

Terminal Usage

Use the -i and -o flags to set the input and output formats. Pipe the input data into stdin.

Missing colors will be automatically replaced with the default colors.

Reading from one file and writing to another:

$ termcolors -i xresources -o json < ~/.Xresources > output.json

Reading from xrdb output, and writing to stdout:

$ xrdb -q | termcolors -i xresources -o text

JS API Usage

var fs = require('fs');
var termcolors = require('termcolors');

var xresources = fs.readFileSync('~/.Xresources', 'utf8');
var colors = termcolors.xresources.import(xresources);

var iterm = termcolors.iterm.export(colors);
fs.writeFile('~/config.itermcolors', iterm);

Supported Formats

Note: only a select few formats support importing.

| Name | ID | Import | Export | |-------------------------|------------------|--------|--------| | Alacritty | alacritty | ✅ | ✅ | | Chrome Secure Shell | chromeshell | | ✅ | | Gnome | gnome | | ✅ | | Guake | guake | | ✅ | | iTerm | iterm | ✅ | ✅ | | JSON | json | ✅ | ✅ | | Kitty | kitty | | ✅ | | Konsole | konsole | | ✅ | | Linux Console | linux | | ✅ | | lxterminal | lxterminal | | ✅ | | MinTTY | mintty | | ✅ | | Putty | putty | | ✅ | | Simple Terminal | st | | ✅ | | Terminal.app | terminalapp | ✅ | ✅ | | Terminator | terminator | | ✅ | | Termite | termite | ✅ | ✅ | | Plain Text | text | | ✅ | | Sublime Text / Textmate | textmate | | ✅ | | Tilix | tilix | | ✅ | | urxvt | urxvt | | ✅ | | Wal | wal | | ✅ | | XFCE4 Terminal | xfce | | ✅ | | Windows Terminal | windowsTerminal| ✅ | ✅ | | Xresources | xresources | ✅ | ✅ | | XSHELL | xshell | | ✅ |

DIY Export

Templates use doT.js.

Check the templates folder for some examples.

Usage:

termcolors.export(template, [transformer])

  • template (string)
  • transformer (function)

The transformer is an optional function that is passed the colors input into the template and can transform them for use in the template.

This is useful so that you don't have to use the tinycolor

Example Without Converter:

var template = 'body { background {{=c.background.hexString()}}; }'

var cssTemplate = termcolors.export(template);

Example With Converter:

var template = 'body { background: {{=c.background}}; }'

var toHex = function (colors) {
    return {
        background: colors.background.hexString();
    }
};

var cssTemplate = termcolors.export(template, toHex);

Example With Lodash Mapping:

var _ = require('lodash');
var template = 'body { background: {{=c.background}}; }'

var toHex = _.partialRight(_.mapValues, function (color) {
    return color.hexString();
});

var cssTemplate = termcolors.export(template, toHex);