
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
termcolors
Advanced tools
Import and export between multiple terminal colour scheme formats
Many templates are sourced from the Base16-Builder.
Colors are handled using Colr.
npm install termcolors
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
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);
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 | ✅ |
Templates use doT.js.
Check the templates folder for some examples.
Usage:
termcolors.export(template, [transformer])
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);
FAQs
Convert color schemes to multiple terminal configs
The npm package termcolors receives a total of 0 weekly downloads. As such, termcolors popularity was classified as not popular.
We found that termcolors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.