termcolors-master

所属分类:Linux/Unix编程
开发工具:LINUX
文件大小:64KB
下载次数:0
上传日期:2019-01-18 07:24:19
上 传 者lukecorp14
说明:  imports and exports linux terminal color schemes

文件列表:
.npmignore (45, 2018-07-21)
bin (0, 2018-07-21)
bin\termcolors (2119, 2018-07-21)
config.yaml (9385, 2018-07-21)
examples (0, 2018-07-21)
examples\alacritty.txt (534, 2018-07-21)
examples\chromeshell.txt (282, 2018-07-21)
examples\gnome.txt (3686, 2018-07-21)
examples\guake.txt (636, 2018-07-21)
examples\iterm.txt (5935, 2018-07-21)
examples\json.txt (350, 2018-07-21)
examples\kitty.txt (380, 2018-07-21)
examples\konsole.txt (743, 2018-07-21)
examples\linux.txt (322, 2018-07-21)
examples\mintty.txt (357, 2018-07-21)
examples\putty.txt (598, 2018-07-21)
examples\st.txt (1220, 2018-07-21)
examples\terminalapp.txt (9230, 2018-07-21)
examples\terminator.txt (610, 2018-07-21)
examples\termite.txt (483, 2018-07-21)
examples\text.txt (320, 2018-07-21)
examples\textmate.txt (11053, 2018-07-21)
examples\xfce.txt (339, 2018-07-21)
examples\xresources.txt (537, 2018-07-21)
examples\xshell.txt (354, 2018-07-21)
gulpfile.js (745, 2018-07-21)
lib (0, 2018-07-21)
lib\colr.js (549, 2018-07-21)
lib\exporter.js (816, 2018-07-21)
lib\formats (0, 2018-07-21)
lib\formats\alacritty.js (1226, 2018-07-21)
lib\formats\chrome-secure-shell.js (690, 2018-07-21)
lib\formats\defaults.js (563, 2018-07-21)
lib\formats\gnome.js (331, 2018-07-21)
lib\formats\guake.js (337, 2018-07-21)
lib\formats\iterm.js (1742, 2018-07-21)
lib\formats\json.js (590, 2018-07-21)
lib\formats\kitty.js (333, 2018-07-21)
... ...

# TermColors > Import and export between multiple terminal colour scheme formats Many templates are sourced from the [Base16-Builder](https://github.com/chriskempson/base16-builder). Colors are handled using [Colr](https://github.com/stayradiated/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: ``` shell $ termcolors -i xresources -o json < ~/.Xresources > output.json ``` Reading from `xrdb` output, and writing to stdout: ``` shell $ xrdb -q | termcolors -i xresources -o text ``` ## JS API Usage ```javascript 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` | | | | Konsole | `konsole` | | | | Linux Console | `linux` | | | | MinTTY | `mintty` | | | | Putty | `putty` | | | | Simple Terminal | `st` | | | | Terminal.app | `terminalapp` | | | | Terminator | `terminator` | | | | Termite | `termite` | | | | Plain Text | `text` | | | | Sublime Text / Textmate | `textmate` | | | | XFCE4 Terminal | `xfce` | | | | Xresources | `xresources` | | | ## DIY Export Templates use [doT.js](http://olado.github.io/doT/index.html). 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:** ```javascript var template = 'body { background {{=c.background.hexString()}}; }' var cssTemplate = termcolors.export(template); ``` **Example With Converter:** ```javascript 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:** ```javascript var _ = require('lodash'); var template = 'body { background: {{=c.background}}; }' var toHex = _.partialRight(_.mapValues, function (color) { return color.hexString(); }); var cssTemplate = termcolors.export(template, toHex); ```

近期下载者

相关文件


收藏者