mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 02:42:48 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
13
node_modules/cli-color/.lint
generated
vendored
Normal file
13
node_modules/cli-color/.lint
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
@root
|
||||
|
||||
module
|
||||
node
|
||||
|
||||
indent 2
|
||||
maxlen 100
|
||||
tabs
|
||||
|
||||
ass
|
||||
nomen
|
||||
plusplus
|
||||
vars
|
||||
4
node_modules/cli-color/.npmignore
generated
vendored
Normal file
4
node_modules/cli-color/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.DS_Store
|
||||
/.lintcache
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
15
node_modules/cli-color/.travis.yml
generated
vendored
Normal file
15
node_modules/cli-color/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
sudo: false # http://docs.travis-ci.com/user/workers/container-based-infrastructure/
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.10
|
||||
- 0.12
|
||||
- iojs
|
||||
|
||||
before_install:
|
||||
- mkdir node_modules; ln -s ../ node_modules/cli-color
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- medikoo+cli-color@medikoo.com
|
||||
|
||||
script: "npm test && npm run lint"
|
||||
99
node_modules/cli-color/CHANGES
generated
vendored
Normal file
99
node_modules/cli-color/CHANGES
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
v1.1.0 -- 2015.10.13
|
||||
* Add clc.slice and clc.getStrippedLength (thanks @StreetStrider)
|
||||
* Add examples folder (thanks @ralphtheninja)
|
||||
|
||||
v1.0.0 -- 2015.04.22
|
||||
* General modularization and files reorganization. From now on each utility is placed in individual
|
||||
module, and can be required directly without others. Alternatively all modules are provided on
|
||||
index module
|
||||
* Support style nesting (thanks @rentalhost)
|
||||
* Rename `trim` to `strip`
|
||||
* Improve `strip` (previously `trim`) regex by relying on ansi-regex package
|
||||
* Improve resolution of window size
|
||||
* Add `columns` utility
|
||||
* Add `art` utility (thanks @rentalhost)
|
||||
* Add visual test (thanks @rentalhost)
|
||||
* Drop support for v0.8 node
|
||||
* Update lint configuration
|
||||
|
||||
v0.3.3 -- 2015.03.20
|
||||
* Fix throbber tests
|
||||
* Fix spelling of LICENSE
|
||||
* Improve documentation
|
||||
* Configure lint scripts
|
||||
|
||||
v0.3.2 -- 2014.04.27
|
||||
* Fix errorneous dependency version in package.json
|
||||
|
||||
v0.3.1 -- 2014.04.27
|
||||
* Update package.json to use latest 'tad' engine (fixes tests evaluation)
|
||||
|
||||
v0.3.0 -- 2014.04.27
|
||||
* Move out all main modules from lib folder
|
||||
* Improve `throbber` utility, so it no longer relies on `clock/lib/interval` interface
|
||||
and it's easier to use on its own
|
||||
* Update internals to use latest versions of dependencies
|
||||
* Remove Makefile (it's cross environement package)
|
||||
|
||||
v0.2.3 -- 2013.09.16
|
||||
Add `blink`
|
||||
|
||||
v0.2.2 -- 2013.02.20
|
||||
* Fix trim, so it tims all kind of ANSI sequence codes correctly
|
||||
* Do not rely on getWindowSize (it may not be available at all)
|
||||
* Fix some xterm colors references in documentation
|
||||
* Add Missing MIT licence
|
||||
|
||||
v0.2.1 -- 2012.10.05
|
||||
Maintanance (Use v0.2 of memoizee)
|
||||
|
||||
v0.2.0 -- 2012.09.19
|
||||
Major refactor of internal algorithm, addition of new functionalities
|
||||
|
||||
Changes:
|
||||
* Bright variants are now set as individual colors (not as additional
|
||||
characteristics as it was in 0.1.x). We should do: clc.redBright instead of
|
||||
clc.red.bright
|
||||
* Removed 'gray' color, clc.blackBright has same effect and should be used
|
||||
instead
|
||||
|
||||
New functionalities:
|
||||
* Already prepared configurations can now be extended directly, e.g.:
|
||||
var error = clc.red;
|
||||
var majorError = error.bold;
|
||||
* 256 xTerm color support via xterm(n) and bgXterm(n) functions
|
||||
* Move around functions: clc.move, clc.moveTo, clc.bol, clc.up, clc.down, clc.right and clc.left
|
||||
* clc.reset - Outputs string that clears the terminal
|
||||
* clc.beep
|
||||
* clc.width & clc.height - Terminal characteristics properties
|
||||
|
||||
v0.1.7 -- 2012.06.13
|
||||
* Update up to v0.8 branch of es5-extre
|
||||
* package.json now in npm friendly format
|
||||
|
||||
v0.1.6 -- 2012.01.22
|
||||
* Update dependencies to latest versions
|
||||
* Travis CI support
|
||||
* More reliable tests for throbber
|
||||
|
||||
v0.1.5 -- 2011.12.12
|
||||
* Cleared npm warning for misnamed property in package.json
|
||||
|
||||
v0.1.4 -- 2011.10.05
|
||||
* Added bright color variants
|
||||
|
||||
v0.1.3 -- 2011.08.08
|
||||
* Added TAD test suite to devDependencies, configured test commands.
|
||||
Tests can be run with 'make test' or 'npm test'
|
||||
|
||||
v0.1.2 -- 2011.08.08
|
||||
* trim - for removing ANSI formatting from string
|
||||
* throbber - displays throbber with preconfigured interval
|
||||
* Compatibility with es5-ext v0.6
|
||||
* Test with TAD
|
||||
|
||||
v0.1.1 -- 2011.07.12
|
||||
* Better documentation
|
||||
|
||||
v0.1.0 -- 2011.07.11
|
||||
* Initial version
|
||||
19
node_modules/cli-color/LICENSE
generated
vendored
Normal file
19
node_modules/cli-color/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (C) 2012 Mariusz Nowak (www.medikoo.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
661
node_modules/cli-color/README.md
generated
vendored
Normal file
661
node_modules/cli-color/README.md
generated
vendored
Normal file
@@ -0,0 +1,661 @@
|
||||
# cli-color
|
||||
## Yet another colors and formatting for the console solution
|
||||
|
||||
Colors, formatting and other goodies for the console. This package won't mess with built-ins and provides neat way to predefine formatting patterns, see below.
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install cli-color
|
||||
|
||||
## Usage
|
||||
|
||||
Usage:
|
||||
|
||||
```javascript
|
||||
var clc = require('cli-color');
|
||||
```
|
||||
|
||||
Output colored text:
|
||||
|
||||
```javascript
|
||||
console.log(clc.red('Text in red'));
|
||||
```
|
||||
|
||||
Styles can be mixed:
|
||||
|
||||
```javascript
|
||||
console.log(clc.red.bgWhite.underline('Underlined red text on white background.'));
|
||||
```
|
||||
|
||||
Styled text can be mixed with unstyled:
|
||||
|
||||
```javascript
|
||||
console.log(clc.red('red') + ' plain ' + clc.blue('blue'));
|
||||
```
|
||||
|
||||
Styled text can be nested:
|
||||
|
||||
```javascript
|
||||
console.log(clc.red('red ' + clc.blue('blue') + ' red'));
|
||||
```
|
||||
|
||||
__Best way is to predefine needed stylings and then use it__:
|
||||
|
||||
```javascript
|
||||
var error = clc.red.bold;
|
||||
var warn = clc.yellow;
|
||||
var notice = clc.blue;
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warn('Warning'));
|
||||
console.log(notice('Notice'));
|
||||
```
|
||||
|
||||
Supported are all ANSI colors and styles:
|
||||
|
||||
#### Styles
|
||||
|
||||
Styles will display correctly if font used in your console supports them.
|
||||
|
||||
* bold
|
||||
* italic
|
||||
* underline
|
||||
* blink
|
||||
* inverse
|
||||
* strike
|
||||
|
||||
#### Colors
|
||||
|
||||
<table>
|
||||
<thead><th>Foreground</th><th>Background</th><th></th></thead>
|
||||
<tbody>
|
||||
<tr><td>black</td><td>bgBlack</td><td><img src="http://medyk.org/colors/000000.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>red</td><td>bgRed</td><td><img src="http://medyk.org/colors/800000.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>green</td><td>bgGreen</td><td><img src="http://medyk.org/colors/008000.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>yellow</td><td>bgYellow</td><td><img src="http://medyk.org/colors/808000.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>blue</td><td>bgBlue</td><td><img src="http://medyk.org/colors/000080.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>magenta</td><td>bgMagenta</td><td><img src="http://medyk.org/colors/800080.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>cyan</td><td>bgCyan</td><td><img src="http://medyk.org/colors/008080.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>white</td><td>bgWhite</td><td><img src="http://medyk.org/colors/c0c0c0.png" width="30" height="30" /></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
##### Bright variants
|
||||
|
||||
<table>
|
||||
<thead><th>Foreground</th><th>Background</th><th></th></thead>
|
||||
<tbody>
|
||||
<tr><td>blackBright</td><td>bgBlackBright</td><td><img src="http://medyk.org/colors/808080.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>redBright</td><td>bgRedBright</td><td><img src="http://medyk.org/colors/ff0000.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>greenBright</td><td>bgGreenBright</td><td><img src="http://medyk.org/colors/00ff00.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>yellowBright</td><td>bgYellowBright</td><td><img src="http://medyk.org/colors/ffff00.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>blueBright</td><td>bgBlueBright</td><td><img src="http://medyk.org/colors/0000ff.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>magentaBright</td><td>bgMagentaBright</td><td><img src="http://medyk.org/colors/ff00ff.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>cyanBright</td><td>bgCyanBright</td><td><img src="http://medyk.org/colors/00ffff.png" width="30" height="30" /></td></tr>
|
||||
<tr><td>whiteBright</td><td>bgWhiteBright</td><td><img src="http://medyk.org/colors/ffffff.png" width="30" height="30" /></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
##### xTerm colors (256 colors table)
|
||||
|
||||
__Not supported on Windows and some terminals__. However if used in not supported environment, the closest color from basic (16 colors) palette is chosen.
|
||||
|
||||
Usage:
|
||||
|
||||
```javascript
|
||||
var msg = clc.xterm(202).bgXterm(236);
|
||||
console.log(msg('Orange text on dark gray background'));
|
||||
```
|
||||
|
||||
Color table:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>0</td><td><img src="http://medyk.org/colors/000000.png" width="20" height="20" /></td>
|
||||
<td>1</td><td><img src="http://medyk.org/colors/800000.png" width="20" height="20" /></td>
|
||||
<td>2</td><td><img src="http://medyk.org/colors/008000.png" width="20" height="20" /></td>
|
||||
<td>3</td><td><img src="http://medyk.org/colors/808000.png" width="20" height="20" /></td>
|
||||
<td>4</td><td><img src="http://medyk.org/colors/000080.png" width="20" height="20" /></td>
|
||||
<td>5</td><td><img src="http://medyk.org/colors/800080.png" width="20" height="20" /></td>
|
||||
<td>6</td><td><img src="http://medyk.org/colors/008080.png" width="20" height="20" /></td>
|
||||
<td>7</td><td><img src="http://medyk.org/colors/c0c0c0.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8</td><td><img src="http://medyk.org/colors/808080.png" width="20" height="20" /></td>
|
||||
<td>9</td><td><img src="http://medyk.org/colors/ff0000.png" width="20" height="20" /></td>
|
||||
<td>10</td><td><img src="http://medyk.org/colors/00ff00.png" width="20" height="20" /></td>
|
||||
<td>11</td><td><img src="http://medyk.org/colors/ffff00.png" width="20" height="20" /></td>
|
||||
<td>12</td><td><img src="http://medyk.org/colors/0000ff.png" width="20" height="20" /></td>
|
||||
<td>13</td><td><img src="http://medyk.org/colors/ff00ff.png" width="20" height="20" /></td>
|
||||
<td>14</td><td><img src="http://medyk.org/colors/00ffff.png" width="20" height="20" /></td>
|
||||
<td>15</td><td><img src="http://medyk.org/colors/ffffff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>16</td><td><img src="http://medyk.org/colors/000000.png" width="20" height="20" /></td>
|
||||
<td>17</td><td><img src="http://medyk.org/colors/00005f.png" width="20" height="20" /></td>
|
||||
<td>18</td><td><img src="http://medyk.org/colors/000087.png" width="20" height="20" /></td>
|
||||
<td>19</td><td><img src="http://medyk.org/colors/0000af.png" width="20" height="20" /></td>
|
||||
<td>20</td><td><img src="http://medyk.org/colors/0000d7.png" width="20" height="20" /></td>
|
||||
<td>21</td><td><img src="http://medyk.org/colors/0000ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>22</td><td><img src="http://medyk.org/colors/005f00.png" width="20" height="20" /></td>
|
||||
<td>23</td><td><img src="http://medyk.org/colors/005f5f.png" width="20" height="20" /></td>
|
||||
<td>24</td><td><img src="http://medyk.org/colors/005f87.png" width="20" height="20" /></td>
|
||||
<td>25</td><td><img src="http://medyk.org/colors/005faf.png" width="20" height="20" /></td>
|
||||
<td>26</td><td><img src="http://medyk.org/colors/005fd7.png" width="20" height="20" /></td>
|
||||
<td>27</td><td><img src="http://medyk.org/colors/005fff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>28</td><td><img src="http://medyk.org/colors/008700.png" width="20" height="20" /></td>
|
||||
<td>29</td><td><img src="http://medyk.org/colors/00875f.png" width="20" height="20" /></td>
|
||||
<td>30</td><td><img src="http://medyk.org/colors/008787.png" width="20" height="20" /></td>
|
||||
<td>31</td><td><img src="http://medyk.org/colors/0087af.png" width="20" height="20" /></td>
|
||||
<td>32</td><td><img src="http://medyk.org/colors/0087d7.png" width="20" height="20" /></td>
|
||||
<td>33</td><td><img src="http://medyk.org/colors/0087ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>34</td><td><img src="http://medyk.org/colors/00af00.png" width="20" height="20" /></td>
|
||||
<td>35</td><td><img src="http://medyk.org/colors/00af5f.png" width="20" height="20" /></td>
|
||||
<td>36</td><td><img src="http://medyk.org/colors/00af87.png" width="20" height="20" /></td>
|
||||
<td>37</td><td><img src="http://medyk.org/colors/00afaf.png" width="20" height="20" /></td>
|
||||
<td>38</td><td><img src="http://medyk.org/colors/00afd7.png" width="20" height="20" /></td>
|
||||
<td>39</td><td><img src="http://medyk.org/colors/00afff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>40</td><td><img src="http://medyk.org/colors/00d700.png" width="20" height="20" /></td>
|
||||
<td>41</td><td><img src="http://medyk.org/colors/00d75f.png" width="20" height="20" /></td>
|
||||
<td>42</td><td><img src="http://medyk.org/colors/00d787.png" width="20" height="20" /></td>
|
||||
<td>43</td><td><img src="http://medyk.org/colors/00d7af.png" width="20" height="20" /></td>
|
||||
<td>44</td><td><img src="http://medyk.org/colors/00d7d7.png" width="20" height="20" /></td>
|
||||
<td>45</td><td><img src="http://medyk.org/colors/00d7ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>46</td><td><img src="http://medyk.org/colors/00ff00.png" width="20" height="20" /></td>
|
||||
<td>47</td><td><img src="http://medyk.org/colors/00ff5f.png" width="20" height="20" /></td>
|
||||
<td>48</td><td><img src="http://medyk.org/colors/00ff87.png" width="20" height="20" /></td>
|
||||
<td>49</td><td><img src="http://medyk.org/colors/00ffaf.png" width="20" height="20" /></td>
|
||||
<td>50</td><td><img src="http://medyk.org/colors/00ffd7.png" width="20" height="20" /></td>
|
||||
<td>51</td><td><img src="http://medyk.org/colors/00ffff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>52</td><td><img src="http://medyk.org/colors/5f0000.png" width="20" height="20" /></td>
|
||||
<td>53</td><td><img src="http://medyk.org/colors/5f005f.png" width="20" height="20" /></td>
|
||||
<td>54</td><td><img src="http://medyk.org/colors/5f0087.png" width="20" height="20" /></td>
|
||||
<td>55</td><td><img src="http://medyk.org/colors/5f00af.png" width="20" height="20" /></td>
|
||||
<td>56</td><td><img src="http://medyk.org/colors/5f00d7.png" width="20" height="20" /></td>
|
||||
<td>57</td><td><img src="http://medyk.org/colors/5f00ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>58</td><td><img src="http://medyk.org/colors/5f5f00.png" width="20" height="20" /></td>
|
||||
<td>59</td><td><img src="http://medyk.org/colors/5f5f5f.png" width="20" height="20" /></td>
|
||||
<td>60</td><td><img src="http://medyk.org/colors/5f5f87.png" width="20" height="20" /></td>
|
||||
<td>61</td><td><img src="http://medyk.org/colors/5f5faf.png" width="20" height="20" /></td>
|
||||
<td>62</td><td><img src="http://medyk.org/colors/5f5fd7.png" width="20" height="20" /></td>
|
||||
<td>63</td><td><img src="http://medyk.org/colors/5f5fff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>64</td><td><img src="http://medyk.org/colors/5f8700.png" width="20" height="20" /></td>
|
||||
<td>65</td><td><img src="http://medyk.org/colors/5f875f.png" width="20" height="20" /></td>
|
||||
<td>66</td><td><img src="http://medyk.org/colors/5f8787.png" width="20" height="20" /></td>
|
||||
<td>67</td><td><img src="http://medyk.org/colors/5f87af.png" width="20" height="20" /></td>
|
||||
<td>68</td><td><img src="http://medyk.org/colors/5f87d7.png" width="20" height="20" /></td>
|
||||
<td>69</td><td><img src="http://medyk.org/colors/5f87ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>70</td><td><img src="http://medyk.org/colors/5faf00.png" width="20" height="20" /></td>
|
||||
<td>71</td><td><img src="http://medyk.org/colors/5faf5f.png" width="20" height="20" /></td>
|
||||
<td>72</td><td><img src="http://medyk.org/colors/5faf87.png" width="20" height="20" /></td>
|
||||
<td>73</td><td><img src="http://medyk.org/colors/5fafaf.png" width="20" height="20" /></td>
|
||||
<td>74</td><td><img src="http://medyk.org/colors/5fafd7.png" width="20" height="20" /></td>
|
||||
<td>75</td><td><img src="http://medyk.org/colors/5fafff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>76</td><td><img src="http://medyk.org/colors/5fd700.png" width="20" height="20" /></td>
|
||||
<td>77</td><td><img src="http://medyk.org/colors/5fd75f.png" width="20" height="20" /></td>
|
||||
<td>78</td><td><img src="http://medyk.org/colors/5fd787.png" width="20" height="20" /></td>
|
||||
<td>79</td><td><img src="http://medyk.org/colors/5fd7af.png" width="20" height="20" /></td>
|
||||
<td>80</td><td><img src="http://medyk.org/colors/5fd7d7.png" width="20" height="20" /></td>
|
||||
<td>81</td><td><img src="http://medyk.org/colors/5fd7ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>82</td><td><img src="http://medyk.org/colors/5fff00.png" width="20" height="20" /></td>
|
||||
<td>83</td><td><img src="http://medyk.org/colors/5fff5f.png" width="20" height="20" /></td>
|
||||
<td>84</td><td><img src="http://medyk.org/colors/5fff87.png" width="20" height="20" /></td>
|
||||
<td>85</td><td><img src="http://medyk.org/colors/5fffaf.png" width="20" height="20" /></td>
|
||||
<td>86</td><td><img src="http://medyk.org/colors/5fffd7.png" width="20" height="20" /></td>
|
||||
<td>87</td><td><img src="http://medyk.org/colors/5fffff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>88</td><td><img src="http://medyk.org/colors/870000.png" width="20" height="20" /></td>
|
||||
<td>89</td><td><img src="http://medyk.org/colors/87005f.png" width="20" height="20" /></td>
|
||||
<td>90</td><td><img src="http://medyk.org/colors/870087.png" width="20" height="20" /></td>
|
||||
<td>91</td><td><img src="http://medyk.org/colors/8700af.png" width="20" height="20" /></td>
|
||||
<td>92</td><td><img src="http://medyk.org/colors/8700d7.png" width="20" height="20" /></td>
|
||||
<td>93</td><td><img src="http://medyk.org/colors/8700ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>94</td><td><img src="http://medyk.org/colors/875f00.png" width="20" height="20" /></td>
|
||||
<td>95</td><td><img src="http://medyk.org/colors/875f5f.png" width="20" height="20" /></td>
|
||||
<td>96</td><td><img src="http://medyk.org/colors/875f87.png" width="20" height="20" /></td>
|
||||
<td>97</td><td><img src="http://medyk.org/colors/875faf.png" width="20" height="20" /></td>
|
||||
<td>98</td><td><img src="http://medyk.org/colors/875fd7.png" width="20" height="20" /></td>
|
||||
<td>99</td><td><img src="http://medyk.org/colors/875fff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>100</td><td><img src="http://medyk.org/colors/878700.png" width="20" height="20" /></td>
|
||||
<td>101</td><td><img src="http://medyk.org/colors/87875f.png" width="20" height="20" /></td>
|
||||
<td>102</td><td><img src="http://medyk.org/colors/878787.png" width="20" height="20" /></td>
|
||||
<td>103</td><td><img src="http://medyk.org/colors/8787af.png" width="20" height="20" /></td>
|
||||
<td>104</td><td><img src="http://medyk.org/colors/8787d7.png" width="20" height="20" /></td>
|
||||
<td>105</td><td><img src="http://medyk.org/colors/8787ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>106</td><td><img src="http://medyk.org/colors/87af00.png" width="20" height="20" /></td>
|
||||
<td>107</td><td><img src="http://medyk.org/colors/87af5f.png" width="20" height="20" /></td>
|
||||
<td>108</td><td><img src="http://medyk.org/colors/87af87.png" width="20" height="20" /></td>
|
||||
<td>109</td><td><img src="http://medyk.org/colors/87afaf.png" width="20" height="20" /></td>
|
||||
<td>110</td><td><img src="http://medyk.org/colors/87afd7.png" width="20" height="20" /></td>
|
||||
<td>111</td><td><img src="http://medyk.org/colors/87afff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>112</td><td><img src="http://medyk.org/colors/87d700.png" width="20" height="20" /></td>
|
||||
<td>113</td><td><img src="http://medyk.org/colors/87d75f.png" width="20" height="20" /></td>
|
||||
<td>114</td><td><img src="http://medyk.org/colors/87d787.png" width="20" height="20" /></td>
|
||||
<td>115</td><td><img src="http://medyk.org/colors/87d7af.png" width="20" height="20" /></td>
|
||||
<td>116</td><td><img src="http://medyk.org/colors/87d7d7.png" width="20" height="20" /></td>
|
||||
<td>117</td><td><img src="http://medyk.org/colors/87d7ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>118</td><td><img src="http://medyk.org/colors/87ff00.png" width="20" height="20" /></td>
|
||||
<td>119</td><td><img src="http://medyk.org/colors/87ff5f.png" width="20" height="20" /></td>
|
||||
<td>120</td><td><img src="http://medyk.org/colors/87ff87.png" width="20" height="20" /></td>
|
||||
<td>121</td><td><img src="http://medyk.org/colors/87ffaf.png" width="20" height="20" /></td>
|
||||
<td>122</td><td><img src="http://medyk.org/colors/87ffd7.png" width="20" height="20" /></td>
|
||||
<td>123</td><td><img src="http://medyk.org/colors/87ffff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>124</td><td><img src="http://medyk.org/colors/af0000.png" width="20" height="20" /></td>
|
||||
<td>125</td><td><img src="http://medyk.org/colors/af005f.png" width="20" height="20" /></td>
|
||||
<td>126</td><td><img src="http://medyk.org/colors/af0087.png" width="20" height="20" /></td>
|
||||
<td>127</td><td><img src="http://medyk.org/colors/af00af.png" width="20" height="20" /></td>
|
||||
<td>128</td><td><img src="http://medyk.org/colors/af00d7.png" width="20" height="20" /></td>
|
||||
<td>129</td><td><img src="http://medyk.org/colors/af00ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>130</td><td><img src="http://medyk.org/colors/af5f00.png" width="20" height="20" /></td>
|
||||
<td>131</td><td><img src="http://medyk.org/colors/af5f5f.png" width="20" height="20" /></td>
|
||||
<td>132</td><td><img src="http://medyk.org/colors/af5f87.png" width="20" height="20" /></td>
|
||||
<td>133</td><td><img src="http://medyk.org/colors/af5faf.png" width="20" height="20" /></td>
|
||||
<td>134</td><td><img src="http://medyk.org/colors/af5fd7.png" width="20" height="20" /></td>
|
||||
<td>135</td><td><img src="http://medyk.org/colors/af5fff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>136</td><td><img src="http://medyk.org/colors/af8700.png" width="20" height="20" /></td>
|
||||
<td>137</td><td><img src="http://medyk.org/colors/af875f.png" width="20" height="20" /></td>
|
||||
<td>138</td><td><img src="http://medyk.org/colors/af8787.png" width="20" height="20" /></td>
|
||||
<td>139</td><td><img src="http://medyk.org/colors/af87af.png" width="20" height="20" /></td>
|
||||
<td>140</td><td><img src="http://medyk.org/colors/af87d7.png" width="20" height="20" /></td>
|
||||
<td>141</td><td><img src="http://medyk.org/colors/af87ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>142</td><td><img src="http://medyk.org/colors/afaf00.png" width="20" height="20" /></td>
|
||||
<td>143</td><td><img src="http://medyk.org/colors/afaf5f.png" width="20" height="20" /></td>
|
||||
<td>144</td><td><img src="http://medyk.org/colors/afaf87.png" width="20" height="20" /></td>
|
||||
<td>145</td><td><img src="http://medyk.org/colors/afafaf.png" width="20" height="20" /></td>
|
||||
<td>146</td><td><img src="http://medyk.org/colors/afafd7.png" width="20" height="20" /></td>
|
||||
<td>147</td><td><img src="http://medyk.org/colors/afafff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>148</td><td><img src="http://medyk.org/colors/afd700.png" width="20" height="20" /></td>
|
||||
<td>149</td><td><img src="http://medyk.org/colors/afd75f.png" width="20" height="20" /></td>
|
||||
<td>150</td><td><img src="http://medyk.org/colors/afd787.png" width="20" height="20" /></td>
|
||||
<td>151</td><td><img src="http://medyk.org/colors/afd7af.png" width="20" height="20" /></td>
|
||||
<td>152</td><td><img src="http://medyk.org/colors/afd7d7.png" width="20" height="20" /></td>
|
||||
<td>153</td><td><img src="http://medyk.org/colors/afd7ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>154</td><td><img src="http://medyk.org/colors/afff00.png" width="20" height="20" /></td>
|
||||
<td>155</td><td><img src="http://medyk.org/colors/afff5f.png" width="20" height="20" /></td>
|
||||
<td>156</td><td><img src="http://medyk.org/colors/afff87.png" width="20" height="20" /></td>
|
||||
<td>157</td><td><img src="http://medyk.org/colors/afffaf.png" width="20" height="20" /></td>
|
||||
<td>158</td><td><img src="http://medyk.org/colors/afffd7.png" width="20" height="20" /></td>
|
||||
<td>159</td><td><img src="http://medyk.org/colors/afffff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>160</td><td><img src="http://medyk.org/colors/d70000.png" width="20" height="20" /></td>
|
||||
<td>161</td><td><img src="http://medyk.org/colors/d7005f.png" width="20" height="20" /></td>
|
||||
<td>162</td><td><img src="http://medyk.org/colors/d70087.png" width="20" height="20" /></td>
|
||||
<td>163</td><td><img src="http://medyk.org/colors/d700af.png" width="20" height="20" /></td>
|
||||
<td>164</td><td><img src="http://medyk.org/colors/d700d7.png" width="20" height="20" /></td>
|
||||
<td>165</td><td><img src="http://medyk.org/colors/d700ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>166</td><td><img src="http://medyk.org/colors/d75f00.png" width="20" height="20" /></td>
|
||||
<td>167</td><td><img src="http://medyk.org/colors/d75f5f.png" width="20" height="20" /></td>
|
||||
<td>168</td><td><img src="http://medyk.org/colors/d75f87.png" width="20" height="20" /></td>
|
||||
<td>169</td><td><img src="http://medyk.org/colors/d75faf.png" width="20" height="20" /></td>
|
||||
<td>170</td><td><img src="http://medyk.org/colors/d75fd7.png" width="20" height="20" /></td>
|
||||
<td>171</td><td><img src="http://medyk.org/colors/d75fff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>172</td><td><img src="http://medyk.org/colors/d78700.png" width="20" height="20" /></td>
|
||||
<td>173</td><td><img src="http://medyk.org/colors/d7875f.png" width="20" height="20" /></td>
|
||||
<td>174</td><td><img src="http://medyk.org/colors/d78787.png" width="20" height="20" /></td>
|
||||
<td>175</td><td><img src="http://medyk.org/colors/d787af.png" width="20" height="20" /></td>
|
||||
<td>176</td><td><img src="http://medyk.org/colors/d787d7.png" width="20" height="20" /></td>
|
||||
<td>177</td><td><img src="http://medyk.org/colors/d787ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>178</td><td><img src="http://medyk.org/colors/d7af00.png" width="20" height="20" /></td>
|
||||
<td>179</td><td><img src="http://medyk.org/colors/d7af5f.png" width="20" height="20" /></td>
|
||||
<td>180</td><td><img src="http://medyk.org/colors/d7af87.png" width="20" height="20" /></td>
|
||||
<td>181</td><td><img src="http://medyk.org/colors/d7afaf.png" width="20" height="20" /></td>
|
||||
<td>182</td><td><img src="http://medyk.org/colors/d7afd7.png" width="20" height="20" /></td>
|
||||
<td>183</td><td><img src="http://medyk.org/colors/d7afff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>184</td><td><img src="http://medyk.org/colors/d7d700.png" width="20" height="20" /></td>
|
||||
<td>185</td><td><img src="http://medyk.org/colors/d7d75f.png" width="20" height="20" /></td>
|
||||
<td>186</td><td><img src="http://medyk.org/colors/d7d787.png" width="20" height="20" /></td>
|
||||
<td>187</td><td><img src="http://medyk.org/colors/d7d7af.png" width="20" height="20" /></td>
|
||||
<td>188</td><td><img src="http://medyk.org/colors/d7d7d7.png" width="20" height="20" /></td>
|
||||
<td>189</td><td><img src="http://medyk.org/colors/d7d7ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>190</td><td><img src="http://medyk.org/colors/d7ff00.png" width="20" height="20" /></td>
|
||||
<td>191</td><td><img src="http://medyk.org/colors/d7ff5f.png" width="20" height="20" /></td>
|
||||
<td>192</td><td><img src="http://medyk.org/colors/d7ff87.png" width="20" height="20" /></td>
|
||||
<td>193</td><td><img src="http://medyk.org/colors/d7ffaf.png" width="20" height="20" /></td>
|
||||
<td>194</td><td><img src="http://medyk.org/colors/d7ffd7.png" width="20" height="20" /></td>
|
||||
<td>195</td><td><img src="http://medyk.org/colors/d7ffff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>196</td><td><img src="http://medyk.org/colors/ff0000.png" width="20" height="20" /></td>
|
||||
<td>197</td><td><img src="http://medyk.org/colors/ff005f.png" width="20" height="20" /></td>
|
||||
<td>198</td><td><img src="http://medyk.org/colors/ff0087.png" width="20" height="20" /></td>
|
||||
<td>199</td><td><img src="http://medyk.org/colors/ff00af.png" width="20" height="20" /></td>
|
||||
<td>200</td><td><img src="http://medyk.org/colors/ff00d7.png" width="20" height="20" /></td>
|
||||
<td>201</td><td><img src="http://medyk.org/colors/ff00ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>202</td><td><img src="http://medyk.org/colors/ff5f00.png" width="20" height="20" /></td>
|
||||
<td>203</td><td><img src="http://medyk.org/colors/ff5f5f.png" width="20" height="20" /></td>
|
||||
<td>204</td><td><img src="http://medyk.org/colors/ff5f87.png" width="20" height="20" /></td>
|
||||
<td>205</td><td><img src="http://medyk.org/colors/ff5faf.png" width="20" height="20" /></td>
|
||||
<td>206</td><td><img src="http://medyk.org/colors/ff5fd7.png" width="20" height="20" /></td>
|
||||
<td>207</td><td><img src="http://medyk.org/colors/ff5fff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>208</td><td><img src="http://medyk.org/colors/ff8700.png" width="20" height="20" /></td>
|
||||
<td>209</td><td><img src="http://medyk.org/colors/ff875f.png" width="20" height="20" /></td>
|
||||
<td>210</td><td><img src="http://medyk.org/colors/ff8787.png" width="20" height="20" /></td>
|
||||
<td>211</td><td><img src="http://medyk.org/colors/ff87af.png" width="20" height="20" /></td>
|
||||
<td>212</td><td><img src="http://medyk.org/colors/ff87d7.png" width="20" height="20" /></td>
|
||||
<td>213</td><td><img src="http://medyk.org/colors/ff87ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>214</td><td><img src="http://medyk.org/colors/ffaf00.png" width="20" height="20" /></td>
|
||||
<td>215</td><td><img src="http://medyk.org/colors/ffaf5f.png" width="20" height="20" /></td>
|
||||
<td>216</td><td><img src="http://medyk.org/colors/ffaf87.png" width="20" height="20" /></td>
|
||||
<td>217</td><td><img src="http://medyk.org/colors/ffafaf.png" width="20" height="20" /></td>
|
||||
<td>218</td><td><img src="http://medyk.org/colors/ffafd7.png" width="20" height="20" /></td>
|
||||
<td>219</td><td><img src="http://medyk.org/colors/ffafff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>220</td><td><img src="http://medyk.org/colors/ffd700.png" width="20" height="20" /></td>
|
||||
<td>221</td><td><img src="http://medyk.org/colors/ffd75f.png" width="20" height="20" /></td>
|
||||
<td>222</td><td><img src="http://medyk.org/colors/ffd787.png" width="20" height="20" /></td>
|
||||
<td>223</td><td><img src="http://medyk.org/colors/ffd7af.png" width="20" height="20" /></td>
|
||||
<td>224</td><td><img src="http://medyk.org/colors/ffd7d7.png" width="20" height="20" /></td>
|
||||
<td>225</td><td><img src="http://medyk.org/colors/ffd7ff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>226</td><td><img src="http://medyk.org/colors/ffff00.png" width="20" height="20" /></td>
|
||||
<td>227</td><td><img src="http://medyk.org/colors/ffff5f.png" width="20" height="20" /></td>
|
||||
<td>228</td><td><img src="http://medyk.org/colors/ffff87.png" width="20" height="20" /></td>
|
||||
<td>229</td><td><img src="http://medyk.org/colors/ffffaf.png" width="20" height="20" /></td>
|
||||
<td>230</td><td><img src="http://medyk.org/colors/ffffd7.png" width="20" height="20" /></td>
|
||||
<td>231</td><td><img src="http://medyk.org/colors/ffffff.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>232</td><td><img src="http://medyk.org/colors/080808.png" width="20" height="20" /></td>
|
||||
<td>233</td><td><img src="http://medyk.org/colors/121212.png" width="20" height="20" /></td>
|
||||
<td>234</td><td><img src="http://medyk.org/colors/1c1c1c.png" width="20" height="20" /></td>
|
||||
<td>235</td><td><img src="http://medyk.org/colors/262626.png" width="20" height="20" /></td>
|
||||
<td>236</td><td><img src="http://medyk.org/colors/303030.png" width="20" height="20" /></td>
|
||||
<td>237</td><td><img src="http://medyk.org/colors/3a3a3a.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>238</td><td><img src="http://medyk.org/colors/444444.png" width="20" height="20" /></td>
|
||||
<td>239</td><td><img src="http://medyk.org/colors/4e4e4e.png" width="20" height="20" /></td>
|
||||
<td>240</td><td><img src="http://medyk.org/colors/585858.png" width="20" height="20" /></td>
|
||||
<td>241</td><td><img src="http://medyk.org/colors/626262.png" width="20" height="20" /></td>
|
||||
<td>242</td><td><img src="http://medyk.org/colors/6c6c6c.png" width="20" height="20" /></td>
|
||||
<td>243</td><td><img src="http://medyk.org/colors/767676.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>244</td><td><img src="http://medyk.org/colors/808080.png" width="20" height="20" /></td>
|
||||
<td>245</td><td><img src="http://medyk.org/colors/8a8a8a.png" width="20" height="20" /></td>
|
||||
<td>246</td><td><img src="http://medyk.org/colors/949494.png" width="20" height="20" /></td>
|
||||
<td>247</td><td><img src="http://medyk.org/colors/9e9e9e.png" width="20" height="20" /></td>
|
||||
<td>248</td><td><img src="http://medyk.org/colors/a8a8a8.png" width="20" height="20" /></td>
|
||||
<td>249</td><td><img src="http://medyk.org/colors/b2b2b2.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>250</td><td><img src="http://medyk.org/colors/bcbcbc.png" width="20" height="20" /></td>
|
||||
<td>251</td><td><img src="http://medyk.org/colors/c6c6c6.png" width="20" height="20" /></td>
|
||||
<td>252</td><td><img src="http://medyk.org/colors/d0d0d0.png" width="20" height="20" /></td>
|
||||
<td>253</td><td><img src="http://medyk.org/colors/dadada.png" width="20" height="20" /></td>
|
||||
<td>254</td><td><img src="http://medyk.org/colors/e4e4e4.png" width="20" height="20" /></td>
|
||||
<td>255</td><td><img src="http://medyk.org/colors/eeeeee.png" width="20" height="20" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
#### Reset
|
||||
|
||||
Terminal can be cleared with `clc.reset`
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.reset);
|
||||
```
|
||||
|
||||
#### Erase
|
||||
|
||||
##### clc.erase.screen
|
||||
|
||||
Entire screen
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.erase.screen);
|
||||
```
|
||||
|
||||
##### clc.erase.screenLeft
|
||||
|
||||
Left portion of a screen
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.erase.screenLeft);
|
||||
```
|
||||
|
||||
##### clc.erase.screenRight
|
||||
|
||||
Right portion of a screen
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.erase.screenRight);
|
||||
```
|
||||
|
||||
##### clc.erase.line
|
||||
|
||||
Current line
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.erase.line);
|
||||
```
|
||||
|
||||
##### clc.erase.lineRight
|
||||
|
||||
Right portion of current line
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.erase.lineRight);
|
||||
```
|
||||
|
||||
##### clc.erase.lineLeft
|
||||
|
||||
Left portion of current line
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.erase.lineLeft);
|
||||
```
|
||||
|
||||
#### Move around functions
|
||||
|
||||
##### clc.move(x, y)
|
||||
|
||||
Move cursor _x_ columns and _y_ rows away. Values can be positive or negative, e.g.:
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.move(-2, -2)); // Move cursors two columns and two rows back
|
||||
```
|
||||
|
||||
##### clc.move.to(x, y)
|
||||
|
||||
Absolute move. Sets cursor position at _x_ column and _y_ row
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.move.to(0, 0)); // Move cursor to first row and first column in terminal window
|
||||
```
|
||||
|
||||
##### clc.move.up(n)
|
||||
|
||||
Move cursor up _n_ rows
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.move.up(2));
|
||||
```
|
||||
|
||||
##### clc.move.down(n)
|
||||
|
||||
Move cursor down _n_ rows
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.move.down(2));
|
||||
```
|
||||
|
||||
##### clc.move.right(n)
|
||||
|
||||
Move cursor right _n_ columns
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.move.right(2));
|
||||
```
|
||||
|
||||
##### clc.move.left(n)
|
||||
|
||||
Move cursor left _n_ columns
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.move.left(2));
|
||||
```
|
||||
|
||||
##### clc.move.lines(n)
|
||||
|
||||
Move cursor `n` lines forward if `n` is positive, otherwise `n` lines backward.
|
||||
|
||||
```javascript
|
||||
process.stdout.write(clc.move.lines(2));
|
||||
```
|
||||
|
||||
#### Terminal characteristics
|
||||
|
||||
##### clc.windowSize.width
|
||||
|
||||
Returns terminal width
|
||||
|
||||
##### clc.windowSize.height
|
||||
|
||||
Returns terminal height
|
||||
|
||||
### Additional functionalities
|
||||
|
||||
#### clc.slice(str[, begin[, end]])
|
||||
|
||||
Slice provided string with preservation of eventual ANSI formatting
|
||||
|
||||
```javascript
|
||||
var clc = require('cli-color')
|
||||
|
||||
var str = clc.bold('foo') + 'bar' + clc.red('elo');
|
||||
var sliced = clc.slice(str, 1, 7); // Same as: clc.bold('oo') + 'bar' + clc.red('e')
|
||||
```
|
||||
|
||||
#### clc.strip(formatedText)
|
||||
|
||||
Strips ANSI formatted string to plain text
|
||||
|
||||
```javascript
|
||||
var ansiStrip = require('cli-color/strip');
|
||||
|
||||
var plain = ansiStrip(formatted);
|
||||
```
|
||||
|
||||
#### clc.getStrippedLength(str, begin, end)
|
||||
|
||||
Slice provided string with preservation of eventual ANSI formatting
|
||||
|
||||
```javascript
|
||||
var clc = require('cli-color');
|
||||
|
||||
var str = clc.bold('foo') + 'bar' + clc.red('elo');
|
||||
clc.getStrippedLength(str); // 9
|
||||
```
|
||||
|
||||
#### clc.art(text, styleConf)
|
||||
|
||||
Create a text-graphical art. Within `styleConf`, string replacements needs to be defined, which are then used to convert `text` to styled graphical text.
|
||||
|
||||
```javascript
|
||||
var text = '.........\n' +
|
||||
'. Hello .\n' +
|
||||
'.........\n';
|
||||
var style = { ".": clc.yellowBright("X") };
|
||||
|
||||
process.stdout.write(clc.art(text, style));
|
||||
```
|
||||
|
||||
##### throbber(write, interval[, format])
|
||||
|
||||
Writes throbber string to _write_ function at given _interval_. Optionally throbber output can be formatted with given _format_ function
|
||||
|
||||
```javascript
|
||||
var setupThrobber = require('cli-color/throbber');
|
||||
|
||||
var throbber = setupThrobber(function (str) {
|
||||
process.stdout.write(str);
|
||||
}, 200);
|
||||
|
||||
throbber.start();
|
||||
|
||||
// at any time you can stop/start throbber
|
||||
throbber.stop();
|
||||
```
|
||||
|
||||
## Tests [](https://travis-ci.org/medikoo/cli-color)
|
||||
|
||||
$ npm test
|
||||
|
||||
## Contributors
|
||||
|
||||
* [@rentalhost](https://github.com/rentalhost) (David Rodrigues)
|
||||
* Help with support for nested styles. Introduction of `clc.art` module, and significant improvements to tests coverage
|
||||
* [@StreetStrider](https://github.com/StreetStrider)
|
||||
* Implementation of sophistcated `clc.slice` functionality, and introduction of `clc.getStrippedLength` utility
|
||||
13
node_modules/cli-color/art.js
generated
vendored
Normal file
13
node_modules/cli-color/art.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var object = require('es5-ext/object/valid-object')
|
||||
, stringifiable = require('es5-ext/object/validate-stringifiable-value')
|
||||
, forOf = require('es6-iterator/for-of');
|
||||
|
||||
module.exports = function (text, style) {
|
||||
var result = '';
|
||||
text = stringifiable(text);
|
||||
object(style);
|
||||
forOf(text, function (char) { result += style[char] || char; });
|
||||
return result;
|
||||
};
|
||||
71
node_modules/cli-color/bare.js
generated
vendored
Normal file
71
node_modules/cli-color/bare.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
'use strict';
|
||||
|
||||
var d = require('d')
|
||||
, assign = require('es5-ext/object/assign')
|
||||
, forEach = require('es5-ext/object/for-each')
|
||||
, map = require('es5-ext/object/map')
|
||||
, primitiveSet = require('es5-ext/object/primitive-set')
|
||||
, setPrototypeOf = require('es5-ext/object/set-prototype-of')
|
||||
, memoize = require('memoizee')
|
||||
, memoizeMethods = require('memoizee/methods')
|
||||
|
||||
, sgr = require('./lib/sgr')
|
||||
, mods = sgr.mods
|
||||
|
||||
, join = Array.prototype.join, defineProperty = Object.defineProperty
|
||||
, max = Math.max, min = Math.min
|
||||
, variantModes = primitiveSet('_fg', '_bg')
|
||||
, xtermMatch, getFn;
|
||||
|
||||
// Some use cli-color as: console.log(clc.red('Error!'));
|
||||
// Which is inefficient as on each call it configures new clc object
|
||||
// with memoization we reuse once created object
|
||||
var memoized = memoize(function (scope, mod) {
|
||||
return defineProperty(getFn(), '_cliColorData', d(assign({}, scope._cliColorData, mod)));
|
||||
});
|
||||
|
||||
var proto = Object.create(Function.prototype, assign(map(mods, function (mod) {
|
||||
return d.gs(function () { return memoized(this, mod); });
|
||||
}), memoizeMethods({
|
||||
// xterm (255) color
|
||||
xterm: d(function (code) {
|
||||
code = isNaN(code) ? 255 : min(max(code, 0), 255);
|
||||
return defineProperty(getFn(), '_cliColorData',
|
||||
d(assign({}, this._cliColorData, {
|
||||
_fg: [xtermMatch ? xtermMatch[code] : ('38;5;' + code), 39]
|
||||
})));
|
||||
}),
|
||||
bgXterm: d(function (code) {
|
||||
code = isNaN(code) ? 255 : min(max(code, 0), 255);
|
||||
return defineProperty(getFn(), '_cliColorData',
|
||||
d(assign({}, this._cliColorData, {
|
||||
_bg: [xtermMatch ? (xtermMatch[code] + 10) : ('48;5;' + code), 49]
|
||||
})));
|
||||
})
|
||||
})));
|
||||
|
||||
var getEndRe = memoize(function (code) {
|
||||
return new RegExp('\x1b\\[' + code + 'm', 'g');
|
||||
}, { primitive: true });
|
||||
|
||||
if (process.platform === 'win32') xtermMatch = require('./lib/xterm-match');
|
||||
|
||||
getFn = function () {
|
||||
return setPrototypeOf(function self(/*…msg*/) {
|
||||
var start = '', end = '', msg = join.call(arguments, ' '), conf = self._cliColorData
|
||||
, hasAnsi = sgr.hasCSI(msg);
|
||||
forEach(conf, function (mod, key) {
|
||||
end = sgr(mod[1]) + end;
|
||||
start += sgr(mod[0]);
|
||||
if (hasAnsi) {
|
||||
msg = msg.replace(getEndRe(mod[1]), variantModes[key] ? sgr(mod[0]) : '');
|
||||
}
|
||||
}, null, true);
|
||||
return start + msg + end;
|
||||
}, proto);
|
||||
};
|
||||
|
||||
module.exports = Object.defineProperties(getFn(), {
|
||||
xtermSupported: d(!xtermMatch),
|
||||
_cliColorData: d('', {})
|
||||
});
|
||||
3
node_modules/cli-color/beep.js
generated
vendored
Normal file
3
node_modules/cli-color/beep.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = '\x07';
|
||||
18
node_modules/cli-color/bin/generate-color-images
generated
vendored
Executable file
18
node_modules/cli-color/bin/generate-color-images
generated
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var uniq = require('es5-ext/array/#/uniq')
|
||||
, deferred = require('deferred')
|
||||
, resolve = require('path').resolve
|
||||
, gm = require('gm')
|
||||
, colors = require('../lib/_xterm-colors');
|
||||
|
||||
gm.prototype.pThumb = deferred.gate(deferred.promisify(gm.prototype.thumb), 50);
|
||||
|
||||
deferred.map(uniq.call(colors), function (color) {
|
||||
return gm('ROSE:').fill('#' + color).drawRectangle(0, 0, 100, 100)
|
||||
.pThumb(1, 1, resolve(__dirname, color + '.png'), 80).aside(function () {
|
||||
console.log('Done: ' + color);
|
||||
});
|
||||
}).done();
|
||||
23
node_modules/cli-color/columns.js
generated
vendored
Normal file
23
node_modules/cli-color/columns.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var from = require('es5-ext/array/from')
|
||||
, iterable = require('es5-ext/iterable/validate-object')
|
||||
, stringifiable = require('es5-ext/object/validate-stringifiable')
|
||||
, pad = require('es5-ext/string/#/pad');
|
||||
|
||||
module.exports = function (rows/*, options*/) {
|
||||
var options = Object(arguments[1]), cols = [];
|
||||
return from(iterable(rows), function (row, index) {
|
||||
return from(iterable(row), function (str, index) {
|
||||
var col = cols[index];
|
||||
if (!col) col = cols[index] = { width: 0 };
|
||||
str = stringifiable(str);
|
||||
if (str.length > col.width) col.width = str.length;
|
||||
return str;
|
||||
});
|
||||
}).map(function (row) {
|
||||
return row.map(function (item, index) {
|
||||
return pad.call(item, ' ', -cols[index].width);
|
||||
}).join((options.sep == null) ? ' | ' : options.sep);
|
||||
}).join('\n') + '\n';
|
||||
};
|
||||
10
node_modules/cli-color/erase.js
generated
vendored
Normal file
10
node_modules/cli-color/erase.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
screen: '\x1b[2J',
|
||||
screenLeft: '\x1b[1J',
|
||||
screenRight: '\x1b[J',
|
||||
line: '\x1b[2K',
|
||||
lineLeft: '\x1b[1K',
|
||||
lineRight: '\x1b[K'
|
||||
};
|
||||
8
node_modules/cli-color/examples/art.js
generated
vendored
Normal file
8
node_modules/cli-color/examples/art.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var clc = require('../');
|
||||
|
||||
var text = '.........\n' + '. Hello .\n' + '.........\n';
|
||||
var style = { ".": clc.yellowBright("X") };
|
||||
|
||||
process.stdout.write(clc.art(text, style));
|
||||
25
node_modules/cli-color/examples/basic.js
generated
vendored
Normal file
25
node_modules/cli-color/examples/basic.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var clc = require('../');
|
||||
|
||||
console.log('Output colored text:');
|
||||
console.log(clc.red('Text in red'));
|
||||
|
||||
console.log('Styles can be mixed:');
|
||||
console.log(clc.red.bgWhite.underline('Underlined red text on white background.'));
|
||||
|
||||
console.log('Styled text can be mixed with unstyled:');
|
||||
console.log(clc.red('red') + ' plain ' + clc.blue('blue'));
|
||||
|
||||
console.log('Styled text can be nested:');
|
||||
console.log(clc.red('red ' + clc.blue('blue') + ' red'));
|
||||
|
||||
console.log('Best way is to predefine needed stylings and then use it:');
|
||||
|
||||
var error = clc.red.bold;
|
||||
var warn = clc.yellow;
|
||||
var notice = clc.blue;
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warn('Warning'));
|
||||
console.log(notice('Notice'));
|
||||
25
node_modules/cli-color/examples/erase.js
generated
vendored
Normal file
25
node_modules/cli-color/examples/erase.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var clc = require('../');
|
||||
|
||||
console.log('Erasing screen ..');
|
||||
|
||||
setTimeout(function () {
|
||||
process.stdout.write(clc.erase.screen);
|
||||
|
||||
console.log('This a line of text that should not be cleared');
|
||||
process.stdout.write('This line will be cleared but cursor will be here ->');
|
||||
|
||||
setTimeout(function () {
|
||||
process.stdout.write(clc.erase.line);
|
||||
process.stdout.write('\nMoving cursor backwards and deleting (from here): to the right');
|
||||
|
||||
setTimeout(function () {
|
||||
process.stdout.write(clc.move(-13, 0));
|
||||
process.stdout.write(clc.erase.lineRight);
|
||||
setTimeout(function () {}, 2000);
|
||||
}, 2000);
|
||||
|
||||
}, 2000);
|
||||
|
||||
}, 2000);
|
||||
10
node_modules/cli-color/examples/styles.js
generated
vendored
Normal file
10
node_modules/cli-color/examples/styles.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var clc = require('../');
|
||||
|
||||
console.log(clc.bold('Bold text'));
|
||||
console.log(clc.italic('Italic text'));
|
||||
console.log(clc.underline('Underlined text'));
|
||||
console.log(clc.blink('Blinking text (might not work for your font)'));
|
||||
console.log(clc.inverse('Inverse text'));
|
||||
console.log(clc.strike('Strikethrough text'));
|
||||
15
node_modules/cli-color/examples/throbber.js
generated
vendored
Normal file
15
node_modules/cli-color/examples/throbber.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var setupThrobber = require('../throbber');
|
||||
|
||||
var throbber = setupThrobber(function (str) {
|
||||
process.stdout.write(str);
|
||||
}, 200);
|
||||
|
||||
process.stdout.write('Throbbing for 3 seconds here -> ');
|
||||
throbber.start();
|
||||
|
||||
setTimeout(function () {
|
||||
console.log();
|
||||
throbber.stop();
|
||||
}, 3000);
|
||||
6
node_modules/cli-color/examples/xterm.js
generated
vendored
Normal file
6
node_modules/cli-color/examples/xterm.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var clc = require('../');
|
||||
|
||||
var msg = clc.xterm(202).bgXterm(236);
|
||||
console.log(msg('Orange text on dark gray background'));
|
||||
10
node_modules/cli-color/get-stripped-length.js
generated
vendored
Normal file
10
node_modules/cli-color/get-stripped-length.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
/*
|
||||
* get actual length of ANSI-formatted string
|
||||
*/
|
||||
|
||||
var strip = require('./strip');
|
||||
|
||||
module.exports = function (str) {
|
||||
return strip(str).length;
|
||||
};
|
||||
17
node_modules/cli-color/index.js
generated
vendored
Normal file
17
node_modules/cli-color/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var d = require('d');
|
||||
|
||||
module.exports = Object.defineProperties(require('./bare'), {
|
||||
windowSize: d(require('./window-size')),
|
||||
erase: d(require('./erase')),
|
||||
move: d(require('./move')),
|
||||
beep: d(require('./beep')),
|
||||
columns: d(require('./columns')),
|
||||
strip: d(require('./strip')),
|
||||
getStrippedLength: d(require('./get-stripped-length')),
|
||||
slice: d(require('./slice')),
|
||||
throbber: d(require('./throbber')),
|
||||
reset: d(require('./reset')),
|
||||
art: d(require('./art'))
|
||||
});
|
||||
107
node_modules/cli-color/lib/sgr.js
generated
vendored
Normal file
107
node_modules/cli-color/lib/sgr.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
'use strict';
|
||||
/* CSI - control sequence introducer */
|
||||
/* SGR - set graphic rendition */
|
||||
|
||||
var assign = require('es5-ext/object/assign')
|
||||
, includes = require('es5-ext/string/#/contains')
|
||||
, forOwn = require('es5-ext/object/for-each')
|
||||
, onlyKey = require('es5-ext/object/first-key')
|
||||
, forEachRight = require('es5-ext/array/#/for-each-right')
|
||||
, uniq = require('es5-ext/array/#/uniq.js');
|
||||
|
||||
var CSI = '\x1b[';
|
||||
|
||||
var sgr = function (code) {
|
||||
return CSI + code + 'm';
|
||||
};
|
||||
|
||||
sgr.CSI = CSI;
|
||||
|
||||
var mods = assign({
|
||||
// Style
|
||||
bold: { _bold: [1, 22] },
|
||||
italic: { _italic: [3, 23] },
|
||||
underline: { _underline: [4, 24] },
|
||||
blink: { _blink: [5, 25] },
|
||||
inverse: { _inverse: [7, 27] },
|
||||
strike: { _strike: [9, 29] }
|
||||
|
||||
// Color
|
||||
}, ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
|
||||
.reduce(function (obj, color, index) {
|
||||
// foreground
|
||||
obj[color] = { _fg: [30 + index, 39] };
|
||||
obj[color + 'Bright'] = { _fg: [90 + index, 39] };
|
||||
|
||||
// background
|
||||
obj['bg' + color[0].toUpperCase() + color.slice(1)] = { _bg: [40 + index, 49] };
|
||||
obj['bg' + color[0].toUpperCase() + color.slice(1) + 'Bright'] = { _bg: [100 + index, 49] };
|
||||
|
||||
return obj;
|
||||
}, {}));
|
||||
|
||||
sgr.mods = mods;
|
||||
|
||||
sgr.openers = {};
|
||||
sgr.closers = {};
|
||||
|
||||
forOwn(mods, function (mod) {
|
||||
var modPair = mod[onlyKey(mod)];
|
||||
|
||||
sgr.openers[modPair[0]] = modPair;
|
||||
sgr.closers[modPair[1]] = modPair;
|
||||
});
|
||||
|
||||
sgr.openStyle = function (mods, code) {
|
||||
mods.push(sgr.openers[code]);
|
||||
};
|
||||
|
||||
sgr.closeStyle = function (mods, code) {
|
||||
forEachRight.call(mods, function (modPair, index) {
|
||||
if (modPair[1] === code) {
|
||||
mods.splice(index, 1);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* prepend openers */
|
||||
sgr.prepend = function (mods) {
|
||||
return mods.map(function (modPair, key) {
|
||||
return sgr(modPair[0]);
|
||||
});
|
||||
};
|
||||
|
||||
/* complete non-closed openers with corresponding closers */
|
||||
sgr.complete = function (mods, closerCodes) {
|
||||
closerCodes.forEach(function (code) {
|
||||
sgr.closeStyle(mods, code);
|
||||
});
|
||||
|
||||
// mods must be closed from the last opened to first opened
|
||||
mods = mods.reverse();
|
||||
|
||||
mods = mods.map(function (modPair, key) {
|
||||
return modPair[1];
|
||||
});
|
||||
|
||||
// one closer can close many openers (31, 32 -> 39)
|
||||
mods = uniq.call(mods);
|
||||
|
||||
return mods.map(sgr);
|
||||
};
|
||||
|
||||
var hasCSI = function (str) {
|
||||
return includes.call(str, CSI);
|
||||
};
|
||||
|
||||
sgr.hasCSI = hasCSI;
|
||||
|
||||
var extractCode = function (csi) {
|
||||
var code = csi.slice(2, -1);
|
||||
code = Number(code);
|
||||
return code;
|
||||
};
|
||||
|
||||
sgr.extractCode = extractCode;
|
||||
|
||||
module.exports = sgr;
|
||||
53
node_modules/cli-color/lib/xterm-colors.js
generated
vendored
Normal file
53
node_modules/cli-color/lib/xterm-colors.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = [
|
||||
"000000", "800000", "008000", "808000", "000080", "800080", "008080", "c0c0c0",
|
||||
"808080", "ff0000", "00ff00", "ffff00", "0000ff", "ff00ff", "00ffff", "ffffff",
|
||||
|
||||
"000000", "00005f", "000087", "0000af", "0000d7", "0000ff",
|
||||
"005f00", "005f5f", "005f87", "005faf", "005fd7", "005fff",
|
||||
"008700", "00875f", "008787", "0087af", "0087d7", "0087ff",
|
||||
"00af00", "00af5f", "00af87", "00afaf", "00afd7", "00afff",
|
||||
"00d700", "00d75f", "00d787", "00d7af", "00d7d7", "00d7ff",
|
||||
"00ff00", "00ff5f", "00ff87", "00ffaf", "00ffd7", "00ffff",
|
||||
|
||||
"5f0000", "5f005f", "5f0087", "5f00af", "5f00d7", "5f00ff",
|
||||
"5f5f00", "5f5f5f", "5f5f87", "5f5faf", "5f5fd7", "5f5fff",
|
||||
"5f8700", "5f875f", "5f8787", "5f87af", "5f87d7", "5f87ff",
|
||||
"5faf00", "5faf5f", "5faf87", "5fafaf", "5fafd7", "5fafff",
|
||||
"5fd700", "5fd75f", "5fd787", "5fd7af", "5fd7d7", "5fd7ff",
|
||||
"5fff00", "5fff5f", "5fff87", "5fffaf", "5fffd7", "5fffff",
|
||||
|
||||
"870000", "87005f", "870087", "8700af", "8700d7", "8700ff",
|
||||
"875f00", "875f5f", "875f87", "875faf", "875fd7", "875fff",
|
||||
"878700", "87875f", "878787", "8787af", "8787d7", "8787ff",
|
||||
"87af00", "87af5f", "87af87", "87afaf", "87afd7", "87afff",
|
||||
"87d700", "87d75f", "87d787", "87d7af", "87d7d7", "87d7ff",
|
||||
"87ff00", "87ff5f", "87ff87", "87ffaf", "87ffd7", "87ffff",
|
||||
|
||||
"af0000", "af005f", "af0087", "af00af", "af00d7", "af00ff",
|
||||
"af5f00", "af5f5f", "af5f87", "af5faf", "af5fd7", "af5fff",
|
||||
"af8700", "af875f", "af8787", "af87af", "af87d7", "af87ff",
|
||||
"afaf00", "afaf5f", "afaf87", "afafaf", "afafd7", "afafff",
|
||||
"afd700", "afd75f", "afd787", "afd7af", "afd7d7", "afd7ff",
|
||||
"afff00", "afff5f", "afff87", "afffaf", "afffd7", "afffff",
|
||||
|
||||
"d70000", "d7005f", "d70087", "d700af", "d700d7", "d700ff",
|
||||
"d75f00", "d75f5f", "d75f87", "d75faf", "d75fd7", "d75fff",
|
||||
"d78700", "d7875f", "d78787", "d787af", "d787d7", "d787ff",
|
||||
"d7af00", "d7af5f", "d7af87", "d7afaf", "d7afd7", "d7afff",
|
||||
"d7d700", "d7d75f", "d7d787", "d7d7af", "d7d7d7", "d7d7ff",
|
||||
"d7ff00", "d7ff5f", "d7ff87", "d7ffaf", "d7ffd7", "d7ffff",
|
||||
|
||||
"ff0000", "ff005f", "ff0087", "ff00af", "ff00d7", "ff00ff",
|
||||
"ff5f00", "ff5f5f", "ff5f87", "ff5faf", "ff5fd7", "ff5fff",
|
||||
"ff8700", "ff875f", "ff8787", "ff87af", "ff87d7", "ff87ff",
|
||||
"ffaf00", "ffaf5f", "ffaf87", "ffafaf", "ffafd7", "ffafff",
|
||||
"ffd700", "ffd75f", "ffd787", "ffd7af", "ffd7d7", "ffd7ff",
|
||||
"ffff00", "ffff5f", "ffff87", "ffffaf", "ffffd7", "ffffff",
|
||||
|
||||
"080808", "121212", "1c1c1c", "262626", "303030", "3a3a3a",
|
||||
"444444", "4e4e4e", "585858", "626262", "6c6c6c", "767676",
|
||||
"808080", "8a8a8a", "949494", "9e9e9e", "a8a8a8", "b2b2b2",
|
||||
"bcbcbc", "c6c6c6", "d0d0d0", "dadada", "e4e4e4", "eeeeee"
|
||||
];
|
||||
40
node_modules/cli-color/lib/xterm-match.js
generated
vendored
Normal file
40
node_modules/cli-color/lib/xterm-match.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
var push = Array.prototype.push, reduce = Array.prototype.reduce, abs = Math.abs
|
||||
, colors, match, result, i;
|
||||
|
||||
colors = require('./xterm-colors').map(function (color) {
|
||||
return {
|
||||
r: parseInt(color.slice(0, 2), 16),
|
||||
g: parseInt(color.slice(2, 4), 16),
|
||||
b: parseInt(color.slice(4), 16)
|
||||
};
|
||||
});
|
||||
|
||||
match = colors.slice(0, 16);
|
||||
|
||||
module.exports = result = [];
|
||||
|
||||
i = 0;
|
||||
while (i < 8) {
|
||||
result.push(30 + i++);
|
||||
}
|
||||
i = 0;
|
||||
while (i < 8) {
|
||||
result.push(90 + i++);
|
||||
}
|
||||
push.apply(result, colors.slice(16).map(function (data) {
|
||||
var index, diff = Infinity;
|
||||
match.every(function (match, i) {
|
||||
var ndiff = reduce.call('rgb', function (diff, channel) {
|
||||
diff += abs(match[channel] - data[channel]);
|
||||
return diff;
|
||||
}, 0);
|
||||
if (ndiff < diff) {
|
||||
index = i;
|
||||
diff = ndiff;
|
||||
}
|
||||
return ndiff;
|
||||
});
|
||||
return result[index];
|
||||
}));
|
||||
36
node_modules/cli-color/move.js
generated
vendored
Normal file
36
node_modules/cli-color/move.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
var d = require('d')
|
||||
, trunc = require('es5-ext/math/trunc')
|
||||
|
||||
, up, down, right, left
|
||||
, abs = Math.abs, floor = Math.floor, max = Math.max;
|
||||
|
||||
var getMove = function (control) {
|
||||
return function (num) {
|
||||
num = isNaN(num) ? 0 : max(floor(num), 0);
|
||||
return num ? ('\x1b[' + num + control) : '';
|
||||
};
|
||||
};
|
||||
module.exports = Object.defineProperties(function (x, y) {
|
||||
x = isNaN(x) ? 0 : floor(x);
|
||||
y = isNaN(y) ? 0 : floor(y);
|
||||
return ((x > 0) ? right(x) : left(-x)) + ((y > 0) ? down(y) : up(-y));
|
||||
}, {
|
||||
up: d(up = getMove('A')),
|
||||
down: d(down = getMove('B')),
|
||||
right: d(right = getMove('C')),
|
||||
left: d(left = getMove('D')),
|
||||
to: d(function (x, y) {
|
||||
x = isNaN(x) ? 1 : (max(floor(x), 0) + 1);
|
||||
y = isNaN(y) ? 1 : (max(floor(y), 0) + 1);
|
||||
return '\x1b[' + y + ';' + x + 'H';
|
||||
}),
|
||||
lines: d(function (n) {
|
||||
var dir;
|
||||
n = trunc(n) || 0;
|
||||
dir = (n >= 0) ? 'E' : 'F';
|
||||
n = floor(abs(n));
|
||||
return '\x1b[' + n + dir;
|
||||
})
|
||||
});
|
||||
96
node_modules/cli-color/package.json
generated
vendored
Normal file
96
node_modules/cli-color/package.json
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"cli-color@^1.1.0",
|
||||
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/mongo-express"
|
||||
]
|
||||
],
|
||||
"_from": "cli-color@>=1.1.0 <2.0.0",
|
||||
"_id": "cli-color@1.1.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/cli-color",
|
||||
"_nodeVersion": "4.1.2",
|
||||
"_npmUser": {
|
||||
"email": "medikoo+npm@medikoo.com",
|
||||
"name": "medikoo"
|
||||
},
|
||||
"_npmVersion": "2.14.4",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "cli-color",
|
||||
"raw": "cli-color@^1.1.0",
|
||||
"rawSpec": "^1.1.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.1.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mongo-express"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cli-color/-/cli-color-1.1.0.tgz",
|
||||
"_shasum": "de188cdc4929d83b67aea04110fbed40fdbf6775",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "cli-color@^1.1.0",
|
||||
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/mongo-express",
|
||||
"author": {
|
||||
"email": "medyk@medikoo.com",
|
||||
"name": "Mariusz Nowak",
|
||||
"url": "http://www.medikoo.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/medikoo/cli-color/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": "2",
|
||||
"d": "^0.1.1",
|
||||
"es5-ext": "^0.10.8",
|
||||
"es6-iterator": "2",
|
||||
"memoizee": "^0.3.9",
|
||||
"timers-ext": "0.1"
|
||||
},
|
||||
"description": "Colors, formatting and other tools for the console",
|
||||
"devDependencies": {
|
||||
"tad": "^0.2.3",
|
||||
"xlint": "^0.2.2",
|
||||
"xlint-jslint-medikoo": "^0.1.4"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "de188cdc4929d83b67aea04110fbed40fdbf6775",
|
||||
"tarball": "http://registry.npmjs.org/cli-color/-/cli-color-1.1.0.tgz"
|
||||
},
|
||||
"gitHead": "67e06956b2b746d7828510c211cb534d7ec07b24",
|
||||
"homepage": "https://github.com/medikoo/cli-color#readme",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"cli",
|
||||
"color",
|
||||
"console",
|
||||
"log",
|
||||
"logging",
|
||||
"shell",
|
||||
"terminal",
|
||||
"xterm"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "medikoo",
|
||||
"email": "medikoo+npm@medikoo.com"
|
||||
}
|
||||
],
|
||||
"name": "cli-color",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/medikoo/cli-color.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream",
|
||||
"lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch",
|
||||
"test": "node ./node_modules/tad/bin/tad"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
3
node_modules/cli-color/reset.js
generated
vendored
Normal file
3
node_modules/cli-color/reset.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = '\x1b[2J\x1b[0;0H';
|
||||
140
node_modules/cli-color/slice.js
generated
vendored
Normal file
140
node_modules/cli-color/slice.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
'use strict';
|
||||
|
||||
var reAnsi = require('ansi-regex')
|
||||
, stringifiable = require('es5-ext/object/validate-stringifiable-value')
|
||||
, length = require('./get-stripped-length')
|
||||
, sgr = require('./lib/sgr')
|
||||
|
||||
, max = Math.max;
|
||||
|
||||
var Token = function Token(token) {
|
||||
this.token = token;
|
||||
};
|
||||
|
||||
var tokenize = function (str) {
|
||||
var match = reAnsi().exec(str);
|
||||
|
||||
if (!match) {
|
||||
return [ str ];
|
||||
}
|
||||
|
||||
var index = match.index
|
||||
, head, prehead, tail;
|
||||
|
||||
if (index === 0) {
|
||||
head = match[0];
|
||||
tail = str.slice(head.length);
|
||||
|
||||
return [ new Token(head) ].concat(tokenize(tail));
|
||||
}
|
||||
|
||||
prehead = str.slice(0, index);
|
||||
head = match[0];
|
||||
tail = str.slice(index + head.length);
|
||||
|
||||
return [ prehead, new Token(head) ].concat(tokenize(tail));
|
||||
};
|
||||
|
||||
var isChunkInSlice = function (chunk, index, begin, end) {
|
||||
var endIndex = chunk.length + index;
|
||||
|
||||
if (begin > endIndex) return false;
|
||||
if (end < index) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
var sliceSeq = function (seq, begin, end) {
|
||||
var sliced = seq.reduce(function (state, chunk) {
|
||||
var index = state.index;
|
||||
|
||||
if (!(chunk instanceof Token)) {
|
||||
var nextChunk = '';
|
||||
|
||||
if (isChunkInSlice(chunk, index, begin, end)) {
|
||||
var relBegin = Math.max(begin - index, 0)
|
||||
, relEnd = Math.min(end - index, chunk.length);
|
||||
|
||||
nextChunk = chunk.slice(relBegin, relEnd);
|
||||
}
|
||||
|
||||
state.seq.push(nextChunk);
|
||||
state.index = index + chunk.length;
|
||||
} else {
|
||||
var code = sgr.extractCode(chunk.token);
|
||||
|
||||
if (index <= begin) {
|
||||
if (code in sgr.openers) {
|
||||
sgr.openStyle(state.preOpeners, code);
|
||||
}
|
||||
if (code in sgr.closers) {
|
||||
sgr.closeStyle(state.preOpeners, code);
|
||||
}
|
||||
} else if (index < end) {
|
||||
if (code in sgr.openers) {
|
||||
sgr.openStyle(state.inOpeners, code);
|
||||
state.seq.push(chunk);
|
||||
} else if (code in sgr.closers) {
|
||||
state.inClosers.push(code);
|
||||
state.seq.push(chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
}, {
|
||||
index: 0,
|
||||
seq: [],
|
||||
|
||||
// preOpeners -> [ mod ]
|
||||
// preOpeners must be prepended to the slice if they wasn't closed til the end of it
|
||||
// preOpeners must be closed if they wasn't closed til the end of the slice
|
||||
preOpeners: [],
|
||||
|
||||
// inOpeners -> [ mod ]
|
||||
// inOpeners already in the slice and must not be prepended to the slice
|
||||
// inOpeners must be closed if they wasn't closed til the end of the slice
|
||||
inOpeners: [], // opener CSI inside slice
|
||||
|
||||
// inClosers -> [ code ]
|
||||
// closer CSIs for determining which pre/in-Openers must be closed
|
||||
inClosers: []
|
||||
});
|
||||
|
||||
sliced.seq = [].concat(
|
||||
sgr.prepend(sliced.preOpeners),
|
||||
sliced.seq,
|
||||
sgr.complete([].concat(sliced.preOpeners, sliced.inOpeners), sliced.inClosers)
|
||||
);
|
||||
|
||||
return sliced.seq;
|
||||
};
|
||||
|
||||
module.exports = function (str/*, begin, end*/) {
|
||||
var seq, begin = Number(arguments[1]), end = Number(arguments[2]), len;
|
||||
|
||||
str = stringifiable(str);
|
||||
len = length(str);
|
||||
|
||||
if (isNaN(begin)) {
|
||||
begin = 0;
|
||||
}
|
||||
if (isNaN(end)) {
|
||||
end = len;
|
||||
}
|
||||
if (begin < 0) {
|
||||
begin = max(len + begin, 0);
|
||||
}
|
||||
if (end < 0) {
|
||||
end = max(len + end, 0);
|
||||
}
|
||||
|
||||
seq = tokenize(str);
|
||||
seq = sliceSeq(seq, begin, end);
|
||||
return seq.map(function (chunk) {
|
||||
if (chunk instanceof Token) {
|
||||
return chunk.token;
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}).join('');
|
||||
};
|
||||
8
node_modules/cli-color/strip.js
generated
vendored
Normal file
8
node_modules/cli-color/strip.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// Strip ANSI formatting from string
|
||||
|
||||
'use strict';
|
||||
|
||||
var stringifiable = require('es5-ext/object/validate-stringifiable')
|
||||
, r = require('ansi-regex')();
|
||||
|
||||
module.exports = function (str) { return stringifiable(str).replace(r, ''); };
|
||||
12
node_modules/cli-color/test/__playground/throbber.formatted.js
generated
vendored
Executable file
12
node_modules/cli-color/test/__playground/throbber.formatted.js
generated
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var setupThrobber = require('../../throbber')
|
||||
, format = require('../../index').red
|
||||
|
||||
, throbber = setupThrobber(process.stdout.write.bind(process.stdout), 200, format);
|
||||
|
||||
process.stdout.write('START');
|
||||
throbber.start();
|
||||
setTimeout(throbber.stop, 1100);
|
||||
11
node_modules/cli-color/test/__playground/throbber.js
generated
vendored
Executable file
11
node_modules/cli-color/test/__playground/throbber.js
generated
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var setupThrobber = require('../../throbber')
|
||||
|
||||
, throbber = setupThrobber(process.stdout.write.bind(process.stdout), 200);
|
||||
|
||||
process.stdout.write('START');
|
||||
throbber.start();
|
||||
setTimeout(throbber.stop, 1100);
|
||||
28
node_modules/cli-color/test/art.js
generated
vendored
Normal file
28
node_modules/cli-color/test/art.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var clc = require('../');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t('ooo', { o: clc.yellow("x") }),
|
||||
'\x1b[33mx\x1b[39m\x1b[33mx\x1b[39m\x1b[33mx\x1b[39m',
|
||||
"Basic art");
|
||||
|
||||
a(t('oyo', { o: clc.yellow("x") }),
|
||||
'\x1b[33mx\x1b[39my\x1b[33mx\x1b[39m',
|
||||
"Free text art");
|
||||
a(t('o o', { o: clc.yellow("x") }),
|
||||
'\x1b[33mx\x1b[39m \x1b[33mx\x1b[39m',
|
||||
"Spaced art");
|
||||
|
||||
a(t('<=>', { "<": clc.yellow("<"), ">": clc.yellow(">") }),
|
||||
'\x1b[33m<\x1b[39m=\x1b[33m>\x1b[39m',
|
||||
"Symbol art");
|
||||
|
||||
a(t('o\no', { o: clc.yellow("x") }),
|
||||
'\x1b[33mx\x1b[39m\n\x1b[33mx\x1b[39m',
|
||||
"Multiline art");
|
||||
|
||||
a(t('ooo', {}),
|
||||
'ooo',
|
||||
"Only text art");
|
||||
};
|
||||
284
node_modules/cli-color/test/bare.js
generated
vendored
Normal file
284
node_modules/cli-color/test/bare.js
generated
vendored
Normal file
@@ -0,0 +1,284 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x, y;
|
||||
|
||||
a(t('test'), 'test', "Plain");
|
||||
a(t('test', 'foo', 3, { toString: function () { return 'bar'; } }),
|
||||
'test foo 3 bar', "Plain: Many args");
|
||||
|
||||
a(t.red('foo'), '\x1b[31mfoo\x1b[39m', "Foreground");
|
||||
a(t.red('foo', 'bar', 3), '\x1b[31mfoo bar 3\x1b[39m',
|
||||
"Foreground: Many args");
|
||||
a(t.red.yellow('foo', 'bar', 3), '\x1b[33mfoo bar 3\x1b[39m',
|
||||
"Foreground: Overriden");
|
||||
a(t.bgRed('foo', 'bar'), '\x1b[41mfoo bar\x1b[49m', "Background");
|
||||
a(t.bgRed.bgYellow('foo', 'bar', 3), '\x1b[43mfoo bar 3\x1b[49m',
|
||||
"Background: Overriden");
|
||||
|
||||
a(t.blue.bgYellow('foo', 'bar'), '\x1b[43m\x1b[34mfoo bar\x1b[39m\x1b[49m',
|
||||
"Foreground & Background");
|
||||
a(t.blue.bgYellow.red.bgMagenta('foo', 'bar'),
|
||||
'\x1b[45m\x1b[31mfoo bar\x1b[39m\x1b[49m',
|
||||
"Foreground & Background: Overriden");
|
||||
|
||||
a(t.bold('foo', 'bar'), '\x1b[1mfoo bar\x1b[22m', "Format");
|
||||
a(t.blink('foobar'), '\x1b[5mfoobar\x1b[25m', "Format: blink");
|
||||
a(t.bold.blue('foo', 'bar', 3), '\x1b[1m\x1b[34mfoo bar 3\x1b[39m\x1b[22m',
|
||||
"Foreground & Format");
|
||||
|
||||
a(t.redBright('foo', 'bar'), '\x1b[91mfoo bar\x1b[39m', "Bright");
|
||||
a(t.bgRedBright('foo', 3), '\x1b[101mfoo 3\x1b[49m', "Bright background");
|
||||
|
||||
a(t.blueBright.bgYellowBright.red.bgMagenta('foo', 'bar'),
|
||||
'\x1b[45m\x1b[31mfoo bar\x1b[39m\x1b[49m',
|
||||
"Foreground & Background: Bright: Overriden");
|
||||
|
||||
a(t.red.blue('foo'), '\x1b[34mfoo\x1b[39m', "Prioritize the Last Color: Blue");
|
||||
a(t.blue.red('foo'), '\x1b[31mfoo\x1b[39m', "Prioritize the Last Color: Red");
|
||||
a(t.bgRed.bgBlue('foo'), '\x1b[44mfoo\x1b[49m', "Prioritize the Last Background Color: Blue");
|
||||
a(t.bgBlue.bgRed('foo'), '\x1b[41mfoo\x1b[49m', "Prioritize the Last Background Color: Red");
|
||||
a(t.bgRed.red.bgBlue.blue('foo'),
|
||||
'\x1b[44m\x1b[34mfoo\x1b[39m\x1b[49m',
|
||||
"Prioritize the Last Mixed Style: Blue");
|
||||
a(t.bgBlue.blue.bgRed.red('foo'),
|
||||
'\x1b[41m\x1b[31mfoo\x1b[39m\x1b[49m',
|
||||
"Prioritize the Last Mixed Style: Red");
|
||||
a(t.bgRed.blue.bgBlue.red('foo'),
|
||||
'\x1b[44m\x1b[31mfoo\x1b[39m\x1b[49m',
|
||||
"Prioritize the Last Mixed Style: BG Blue and Red");
|
||||
a(t.bgBlue.red.bgRed.blue('foo'),
|
||||
'\x1b[41m\x1b[34mfoo\x1b[39m\x1b[49m',
|
||||
"Prioritize the Last Mixed Style: BG Red and Blue");
|
||||
|
||||
a(t.bold('bold ' + t.whiteBright('whiteBright ') + 'bold'),
|
||||
'\x1b[1mbold \x1b[97mwhiteBright \x1b[39mbold\x1b[22m',
|
||||
"Nested Format: Bold Type 1");
|
||||
a(t.white('white ' + t.bold('bold ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[1mbold \x1b[22mwhite\x1b[39m',
|
||||
"Nested Format: Bold Type 2");
|
||||
|
||||
a(t.italic('italic ' + t.whiteBright('whiteBright ') + 'italic'),
|
||||
'\x1b[3mitalic \x1b[97mwhiteBright \x1b[39mitalic\x1b[23m',
|
||||
"Nested Format: Italic");
|
||||
a(t.white('white ' + t.italic('italic ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[3mitalic \x1b[23mwhite\x1b[39m',
|
||||
"Nested Format: Italic Type 2");
|
||||
|
||||
a(t.underline('underline ' + t.whiteBright('whiteBright ') + 'underline'),
|
||||
'\x1b[4munderline \x1b[97mwhiteBright \x1b[39munderline\x1b[24m',
|
||||
"Nested Format: Underline");
|
||||
a(t.white('white ' + t.underline('underline ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[4munderline \x1b[24mwhite\x1b[39m',
|
||||
"Nested Format: Underline Type 2");
|
||||
|
||||
a(t.blink('blink ' + t.whiteBright('whiteBright ') + 'blink'),
|
||||
'\x1b[5mblink \x1b[97mwhiteBright \x1b[39mblink\x1b[25m',
|
||||
"Nested Format: Blink");
|
||||
a(t.white('white ' + t.blink('blink ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[5mblink \x1b[25mwhite\x1b[39m',
|
||||
"Nested Format: Blink Type 2");
|
||||
|
||||
a(t.inverse('inverse ' + t.whiteBright('whiteBright ') + 'inverse'),
|
||||
'\x1b[7minverse \x1b[97mwhiteBright \x1b[39minverse\x1b[27m',
|
||||
"Nested Format: Inverse");
|
||||
a(t.white('white ' + t.inverse('inverse ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[7minverse \x1b[27mwhite\x1b[39m',
|
||||
"Nested Format: Inverse Type 2");
|
||||
|
||||
a(t.strike('strike ' + t.whiteBright('whiteBright ') + 'strike'),
|
||||
'\x1b[9mstrike \x1b[97mwhiteBright \x1b[39mstrike\x1b[29m',
|
||||
"Nested Format: Strike");
|
||||
a(t.white('white ' + t.strike('strike ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[9mstrike \x1b[29mwhite\x1b[39m',
|
||||
"Nested Format: Strike Type 2");
|
||||
|
||||
a(t.red('red ' + t.blue('blue ')),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[31m\x1b[39m',
|
||||
"Nested Foreground: Two Levels Type 1");
|
||||
a(t.red(t.blue('blue ') + 'red'),
|
||||
'\x1b[31m\x1b[34mblue \x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Two Levels Type 2");
|
||||
a(t.red('red ' + t.blue('blue ') + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Two Levels Type 3");
|
||||
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ')) + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34m\x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Three Levels Type 1");
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ') + 'blue ') + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34mblue \x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Three Levels Type 2");
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ')) + t.green('green ') + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34m' +
|
||||
'\x1b[31m\x1b[32mgreen \x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Three Levels Type 3");
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ') + t.yellow('yellow ')) + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34m' +
|
||||
'\x1b[33myellow \x1b[34m\x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Three Levels Type 4");
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ') + "blue " + t.yellow('yellow ')) + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34mblue \x1b[33myellow ' +
|
||||
'\x1b[34m\x1b[31mred\x1b[39m', "Nested Foreground: Three Levels Type 5");
|
||||
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ' + t.yellow('yellow ') + "green ")) + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[33myellow \x1b[32mgreen ' +
|
||||
'\x1b[34m\x1b[31mred\x1b[39m', "Nested Foreground: Four Levels");
|
||||
|
||||
a(t.red('\x1bAred'),
|
||||
'\x1b[31m\x1bAred\x1b[39m',
|
||||
"Nested Foreground: Trap Type 1 - Not a Style Before");
|
||||
a(t.red('red\x1bA'),
|
||||
'\x1b[31mred\x1bA\x1b[39m',
|
||||
"Nested Foreground: Trap Type 2 - Not a Style After");
|
||||
a(t.red('\x1bAred\x1bA'),
|
||||
'\x1b[31m\x1bAred\x1bA\x1b[39m',
|
||||
"Nested Foreground: Trap Type 3 - Not a Style Around");
|
||||
a(t.red('\x1b34m\x1b39m'),
|
||||
'\x1b[31m\x1b34m\x1b39m\x1b[39m',
|
||||
"Nested Foreground: Trap Type 4 - Not a Valid Style");
|
||||
a(t.red('\x1b[34m\x1b[39m'),
|
||||
'\x1b[31m\x1b[34m\x1b[31m\x1b[39m',
|
||||
"Nested Foreground: Trap Type 5 - No Message Style");
|
||||
a(t.red('\x1b[34m\x1b[39m\x1b[34mblue\x1b[39m'),
|
||||
'\x1b[31m\x1b[34m\x1b[31m\x1b[34mblue\x1b[31m\x1b[39m',
|
||||
"Nested Foreground: Trap Type 6 - No Message Style Before");
|
||||
a(t.red('\x1b[34mblue\x1b[39m\x1b[34m\x1b[39m'),
|
||||
'\x1b[31m\x1b[34mblue\x1b[31m\x1b[34m\x1b[31m\x1b[39m',
|
||||
"Nested Foreground: Trap Type 7 - No Message Style After");
|
||||
a(t.red('\x1b[34m\x1b[39m\x1b[34mblue\x1b[39m\x1b[34m\x1b[39m'),
|
||||
'\x1b[31m\x1b[34m\x1b[31m\x1b[34mblue\x1b[31m\x1b[34m\x1b[31m\x1b[39m',
|
||||
"Nested Foreground: Trap Type 8 - No Message Style Around");
|
||||
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ')),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[41m\x1b[49m',
|
||||
"Nested Background: Two Levels Type 1");
|
||||
a(t.bgRed(t.bgBlue('blue ') + 'red'),
|
||||
'\x1b[41m\x1b[44mblue \x1b[41mred\x1b[49m',
|
||||
"Nested Background: Two Levels Type 2");
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ') + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[41mred\x1b[49m',
|
||||
"Nested Background: Two Levels Type 3");
|
||||
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ')) + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44m\x1b[41mred\x1b[49m',
|
||||
"Nested Background: Three Levels Type 1");
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ') + 'blue ') + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44mblue \x1b[41mred\x1b[49m',
|
||||
"Nested Background: Three Levels Type 2");
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ')) + t.bgGreen('green ') + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44m' +
|
||||
'\x1b[41m\x1b[42mgreen \x1b[41mred\x1b[49m',
|
||||
"Nested Background: Three Levels Type 3");
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ') + t.bgYellow('yellow ')) + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44m' +
|
||||
'\x1b[43myellow \x1b[44m\x1b[41mred\x1b[49m',
|
||||
"Nested Background: Three Levels Type 4");
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ') + "blue " +
|
||||
t.bgYellow('yellow ')) + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44mblue \x1b[43myellow ' +
|
||||
'\x1b[44m\x1b[41mred\x1b[49m', "Nested Background: Three Levels Type 5");
|
||||
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ' +
|
||||
t.bgYellow('yellow ') + "green ")) + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[43myellow \x1b[42mgreen ' +
|
||||
'\x1b[44m\x1b[41mred\x1b[49m', "Nested Background: Four Levels");
|
||||
|
||||
a(t.bgRed('\x1bAred'),
|
||||
'\x1b[41m\x1bAred\x1b[49m',
|
||||
"Nested Background: Trap Type 1 - Not a Style Before");
|
||||
a(t.bgRed('red\x1bA'),
|
||||
'\x1b[41mred\x1bA\x1b[49m',
|
||||
"Nested Background: Trap Type 2 - Not a Style After");
|
||||
a(t.bgRed('\x1bAred\x1bA'),
|
||||
'\x1b[41m\x1bAred\x1bA\x1b[49m',
|
||||
"Nested Background: Trap Type 3 - Not a Style Around");
|
||||
a(t.bgRed('\x1b44m\x1b39m'),
|
||||
'\x1b[41m\x1b44m\x1b39m\x1b[49m',
|
||||
"Nested Background: Trap Type 4 - Not a Valid Style");
|
||||
a(t.bgRed('\x1b[44m\x1b[49m'),
|
||||
'\x1b[41m\x1b[44m\x1b[41m\x1b[49m',
|
||||
"Nested Background: Trap Type 5 - No Message Style");
|
||||
a(t.bgRed('\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m'),
|
||||
'\x1b[41m\x1b[44m\x1b[41m\x1b[44mblue\x1b[41m\x1b[49m',
|
||||
"Nested Background: Trap Type 6 - No Message Style Before");
|
||||
a(t.bgRed('\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m'),
|
||||
'\x1b[41m\x1b[44mblue\x1b[41m\x1b[44m\x1b[41m\x1b[49m',
|
||||
"Nested Background: Trap Type 7 - No Message Style After");
|
||||
a(t.bgRed('\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m'),
|
||||
'\x1b[41m\x1b[44m\x1b[41m\x1b[44mblue\x1b[41m\x1b[44m\x1b[41m\x1b[49m',
|
||||
"Nested Background: Trap Type 8 - No Message Style Around");
|
||||
|
||||
a(t.red('red ' + t.bgBlue('blue ')),
|
||||
'\x1b[31mred \x1b[44mblue \x1b[49m\x1b[39m',
|
||||
"Nested Foreground and Background: Two Levels Type 1");
|
||||
a(t.red('red ' + t.bgBlue('blue ') + t.white('white')),
|
||||
'\x1b[31mred \x1b[44mblue \x1b[49m\x1b[37mwhite\x1b[31m\x1b[39m',
|
||||
"Nested Foreground and Background: Two Levels Type 2");
|
||||
a(t.red('red ' + t.bgBlue('blue ') + 'red'),
|
||||
'\x1b[31mred \x1b[44mblue \x1b[49mred\x1b[39m',
|
||||
"Nested Foreground and Background: Two Levels Type 3");
|
||||
a(t.bgBlue('blue ' + t.bgRed('red ' + t.whiteBright('white ') + 'red ') + 'blue'),
|
||||
'\x1b[44mblue \x1b[41mred \x1b[97mwhite \x1b[39mred \x1b[44mblue\x1b[49m',
|
||||
"Nested Foreground and Background: Two Levels Type 3");
|
||||
|
||||
a(t.red.bgWhite('white ' + t.bgBlue('blue')),
|
||||
'\x1b[47m\x1b[31mwhite \x1b[44mblue\x1b[47m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Mixed Type 1");
|
||||
a(t.red.bgWhite('white ' + t.blue('blue')),
|
||||
'\x1b[47m\x1b[31mwhite \x1b[34mblue\x1b[31m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Mixed Type 2");
|
||||
a(t.red.bgWhite('white ' + t.blue('blue ') + 'white'),
|
||||
'\x1b[47m\x1b[31mwhite \x1b[34mblue \x1b[31mwhite\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Mixed Type 3");
|
||||
|
||||
a(t.red.bgWhite('\x1bAred'),
|
||||
'\x1b[47m\x1b[31m\x1bAred\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 1 - Not a Style Before");
|
||||
a(t.red.bgWhite('red\x1bA'),
|
||||
'\x1b[47m\x1b[31mred\x1bA\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 2 - Not a Style After");
|
||||
a(t.red.bgWhite('\x1bAred\x1bA'),
|
||||
'\x1b[47m\x1b[31m\x1bAred\x1bA\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 3 - Not a Style Around");
|
||||
a(t.red.bgWhite('\x1b34m\x1b39m'),
|
||||
'\x1b[47m\x1b[31m\x1b34m\x1b39m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 4 - Not a Valid Style");
|
||||
a(t.red.bgWhite('\x1b[34m\x1b[39m'),
|
||||
'\x1b[47m\x1b[31m\x1b[34m\x1b[31m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 5 - No Message Style");
|
||||
a(t.red.bgWhite('\x1b[44m\x1b[49m'),
|
||||
'\x1b[47m\x1b[31m\x1b[44m\x1b[47m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 6 - No Message Style");
|
||||
a(t.red.bgWhite('\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m'),
|
||||
'\x1b[47m\x1b[31m\x1b[44m\x1b[47m\x1b[44mblue\x1b[47m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 7 - No Message Style Before");
|
||||
a(t.red.bgWhite('\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m'),
|
||||
'\x1b[47m\x1b[31m\x1b[44mblue\x1b[47m\x1b[44m\x1b[47m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 8 - No Message Style After");
|
||||
a(t.red.bgWhite('\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m'),
|
||||
'\x1b[47m\x1b[31m\x1b[44m\x1b[47m\x1b[44mblue\x1b[47m\x1b[44m\x1b[47m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 9 - No Message Style Around");
|
||||
|
||||
x = t.red;
|
||||
y = x.bold;
|
||||
|
||||
a(x('foo', 'red') + ' ' + y('foo', 'boldred'),
|
||||
'\x1b[31mfoo red\x1b[39m \x1b[1m\x1b[31mfoo boldred\x1b[39m\x1b[22m',
|
||||
"Detached extension");
|
||||
|
||||
if (t.xtermSupported) {
|
||||
a(t.xterm(12).bgXterm(67)('foo', 'xterm'),
|
||||
'\x1b[48;5;67m\x1b[38;5;12mfoo xterm\x1b[39m\x1b[49m', "Xterm");
|
||||
|
||||
a(t.redBright.bgBlueBright.xterm(12).bgXterm(67)('foo', 'xterm'),
|
||||
'\x1b[48;5;67m\x1b[38;5;12mfoo xterm\x1b[39m\x1b[49m',
|
||||
"Xterm: Override & Bright");
|
||||
a(t.xterm(12).bgXterm(67).redBright.bgMagentaBright('foo', 'xterm'),
|
||||
'\x1b[105m\x1b[91mfoo xterm\x1b[39m\x1b[49m',
|
||||
"Xterm: Override & Bright #2");
|
||||
} else {
|
||||
a(t.xterm(12).bgXterm(67)('foo', 'xterm'),
|
||||
'\x1b[100m\x1b[94mfoo xterm\x1b[39m\x1b[49m', "Xterm");
|
||||
}
|
||||
};
|
||||
3
node_modules/cli-color/test/beep.js
generated
vendored
Normal file
3
node_modules/cli-color/test/beep.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) { a(t, '\x07'); };
|
||||
32
node_modules/cli-color/test/columns.js
generated
vendored
Normal file
32
node_modules/cli-color/test/columns.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t([]), '\n', "Empty #1");
|
||||
a(t([ [], [], [] ]), '\n\n\n', "Empty #2");
|
||||
|
||||
a(t([ [ "A", "BC", "DEF" ] ]),
|
||||
'A | BC | DEF\n',
|
||||
"Header Only");
|
||||
|
||||
a(t([ [ "A", "BC", "DEF" ], [ 1, 23, 456 ] ]),
|
||||
'A | BC | DEF\n1 | 23 | 456\n',
|
||||
"Small items");
|
||||
a(t([ [ "A", "BC", "DEF" ], [ 12, 234, 4567 ] ]),
|
||||
'A | BC | DEF \n12 | 234 | 4567\n',
|
||||
"Large items");
|
||||
a(t([ [ "A", "BC", "DEF" ], [ 1234, 23456, 456789 ] ]),
|
||||
'A | BC | DEF \n1234 | 23456 | 456789\n',
|
||||
"Very large items");
|
||||
|
||||
a(t([ [ "A" ], [ 1 ], [ 23 ], [ 456 ] ]),
|
||||
'A \n1 \n23 \n456\n',
|
||||
"Single column");
|
||||
|
||||
a(t([ [ "ID" ], [ 1 ], [ 1, 23 ], [ 1, 23, 456 ] ]),
|
||||
'ID\n1 \n1 | 23\n1 | 23 | 456\n',
|
||||
"Force columns");
|
||||
|
||||
a(t([ [ "ID" ], [ "", "" ], [ 123, 123 ] ]),
|
||||
'ID \n | \n123 | 123\n',
|
||||
"Empty cells");
|
||||
};
|
||||
6
node_modules/cli-color/test/erase.js
generated
vendored
Normal file
6
node_modules/cli-color/test/erase.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.screen, '\x1b[2J');
|
||||
a(t.line, '\x1b[2K');
|
||||
};
|
||||
16
node_modules/cli-color/test/get-stripped-length.js
generated
vendored
Normal file
16
node_modules/cli-color/test/get-stripped-length.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var length = t;
|
||||
|
||||
a(typeof length, 'function');
|
||||
|
||||
a(length('ABC'), 3, "Works on plain string");
|
||||
a(length('\x1b[31mABC\x1b[39m'), 3, "Works on formatted string");
|
||||
a(length('\x1b[31mABC\x1b[39mDE'), 5, "Works on partially formatted string");
|
||||
a(length('\x1b[31mABC\x1b[39mDE'), 5, "Works on formatted string by couple of styles");
|
||||
|
||||
a(length('\x1b[31mABC\x1b[3mDE\x1b[23m\x1b[39m'), 5, "Works on nested formatted string");
|
||||
a(length('\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m'), 9,
|
||||
"Works on nested formatted string with overlapping styles");
|
||||
};
|
||||
16
node_modules/cli-color/test/index.js
generated
vendored
Normal file
16
node_modules/cli-color/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var bareTests = require('./bare');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
bareTests(t, a);
|
||||
|
||||
a(typeof t.windowSize.width, 'number', "Width");
|
||||
|
||||
a(t.move.up(34), '\x1b[34A', "Up: Positive");
|
||||
a(t.move(2, 35), '\x1b[2C\x1b[35B', "Move: two positives");
|
||||
|
||||
a(t.erase.screen, '\x1b[2J', "Erase");
|
||||
|
||||
a(t.beep, '\x07', "Beep");
|
||||
};
|
||||
14
node_modules/cli-color/test/lib/sgr.js
generated
vendored
Normal file
14
node_modules/cli-color/test/lib/sgr.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (sgr, a) {
|
||||
a(sgr(31), '\x1b[31m', "sgr creates set graphic rendition CSIs #1");
|
||||
a(sgr(39), '\x1b[39m', "sgr creates set graphic rendition CSIs #2");
|
||||
|
||||
a(sgr.hasCSI('\x1b[31mA\x1b[39m'), true, "sgr.hasCSI detecs CSIs in string #1");
|
||||
a(sgr.hasCSI('\x1b[31m'), true, "sgr.hasCSI detecs CSIs in string #2");
|
||||
a(sgr.hasCSI('[31m'), false, "sgr.hasCSI detecs CSIs in string #3");
|
||||
a(sgr.hasCSI('A'), false, "sgr.hasCSI detecs CSIs in string #4");
|
||||
|
||||
a(sgr.extractCode('\x1b[31m'), 31, "sgr.extractCode extract numeric code of CSI");
|
||||
a(sgr.extractCode('\x1b[39m'), 39, "sgr.extractCode extract numeric code of CSI");
|
||||
};
|
||||
10
node_modules/cli-color/test/lib/xterm-colors.js
generated
vendored
Normal file
10
node_modules/cli-color/test/lib/xterm-colors.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var re = /^[0-9a-f]{6}$/;
|
||||
|
||||
a(t.length, 256, "Length");
|
||||
t.forEach(function (data, index) {
|
||||
a(re.test(data), true, "In range #" + index);
|
||||
});
|
||||
};
|
||||
9
node_modules/cli-color/test/lib/xterm-match.js
generated
vendored
Normal file
9
node_modules/cli-color/test/lib/xterm-match.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.length, 256, "Length");
|
||||
t.forEach(function (data, index) {
|
||||
a(((data >= 30) && (data <= 37)) || ((data >= 90) && (data <= 97)), true,
|
||||
"In range #" + index);
|
||||
});
|
||||
};
|
||||
37
node_modules/cli-color/test/move.js
generated
vendored
Normal file
37
node_modules/cli-color/test/move.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.up(), '', "Up: No argument");
|
||||
a(t.up({}), '', "Up: Not a number");
|
||||
a(t.up(-34), '', "Up: Negative");
|
||||
a(t.up(34), '\x1b[34A', "Up: Positive");
|
||||
|
||||
a(t.down(), '', "Down: No argument");
|
||||
a(t.down({}), '', "Down: Not a number");
|
||||
a(t.down(-34), '', "Down: Negative");
|
||||
a(t.down(34), '\x1b[34B', "Down: Positive");
|
||||
|
||||
a(t.right(), '', "Right: No argument");
|
||||
a(t.right({}), '', "Right: Not a number");
|
||||
a(t.right(-34), '', "Right: Negative");
|
||||
a(t.right(34), '\x1b[34C', "Right: Positive");
|
||||
|
||||
a(t.left(), '', "Left: No argument");
|
||||
a(t.left({}), '', "Left: Not a number");
|
||||
a(t.left(-34), '', "Left: Negative");
|
||||
a(t.left(34), '\x1b[34D', "Left: Positive");
|
||||
|
||||
a(t(), '', "Move: No arguments");
|
||||
a(t({}, {}), '', "Move: Bad arguments");
|
||||
a(t({}, 12), '\x1b[12B', "Move: One direction");
|
||||
a(t(0, -12), '\x1b[12A', "Move: One negative direction");
|
||||
a(t(-42, -2), '\x1b[42D\x1b[2A', "Move: two negatives");
|
||||
a(t(2, 35), '\x1b[2C\x1b[35B', "Move: two positives");
|
||||
|
||||
a(t.to(), '\x1b[1;1H', "MoveTo: No arguments");
|
||||
a(t.to({}, {}), '\x1b[1;1H', "MoveTo: Bad arguments");
|
||||
a(t.to({}, 12), '\x1b[13;1H', "MoveTo: One direction");
|
||||
a(t.to(2, -12), '\x1b[1;3H', "MoveTo: One negative direction");
|
||||
a(t.to(-42, -2), '\x1b[1;1H', "MoveTo: two negatives");
|
||||
a(t.to(2, 35), '\x1b[36;3H', "MoveTo: two positives");
|
||||
};
|
||||
5
node_modules/cli-color/test/reset.js
generated
vendored
Normal file
5
node_modules/cli-color/test/reset.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t, 'string');
|
||||
};
|
||||
92
node_modules/cli-color/test/slice.js
generated
vendored
Normal file
92
node_modules/cli-color/test/slice.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var slice = t;
|
||||
|
||||
a(typeof slice, 'function');
|
||||
|
||||
a(slice('ABCDE', 1), "BCDE", "Works on plain string");
|
||||
a(slice('ABCDE', -1), "E", "Works on plain string");
|
||||
a(slice('ABCDE', 1, 3), "BC", "Works on plain string");
|
||||
a(slice('ABCDE', -3, -1), "CD", "Works on plain string");
|
||||
|
||||
a(slice('\x1b[31mABCDE\x1b[39m', 1), "\x1b[31mBCDE\x1b[39m",
|
||||
"Works on whole single forecolor-styled string");
|
||||
a(slice('\x1b[31mABCDE\x1b[39m', -1), "\x1b[31mE\x1b[39m",
|
||||
"Works on whole single forecolor-styled string");
|
||||
a(slice('\x1b[31mABCDE\x1b[39m', 1, 3), "\x1b[31mBC\x1b[39m",
|
||||
"Works on whole single forecolor-styled string");
|
||||
a(slice('\x1b[31mABCDE\x1b[39m', -3, -1), "\x1b[31mCD\x1b[39m",
|
||||
"Works on whole single forecolor-styled string");
|
||||
|
||||
a(slice('\x1b[41mABCDE\x1b[49m', 1), "\x1b[41mBCDE\x1b[49m",
|
||||
"Works on whole single backcolor-styled string");
|
||||
a(slice('\x1b[41mABCDE\x1b[49m', -1), "\x1b[41mE\x1b[49m",
|
||||
"Works on whole single backcolor-styled string");
|
||||
a(slice('\x1b[41mABCDE\x1b[49m', 1, 3), "\x1b[41mBC\x1b[49m",
|
||||
"Works on whole single backcolor-styled string");
|
||||
a(slice('\x1b[41mABCDE\x1b[49m', -3, -1), "\x1b[41mCD\x1b[49m",
|
||||
"Works on whole single backcolor-styled string");
|
||||
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', 0, 5), "ABC\x1b[31mDE\x1b[39m",
|
||||
"Save styles when chopping part of the forecolor-styled string");
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', 1, 4), "BC\x1b[31mD\x1b[39m",
|
||||
"Save styles when chopping part of the forecolor-styled string");
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', 1, 6), "BC\x1b[31mDEF\x1b[39m",
|
||||
"Save styles when chopping part of the forecolor-styled string");
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', -5, -1), "BC\x1b[31mDE\x1b[39m",
|
||||
"Save styles when chopping part of the forecolor-styled string");
|
||||
|
||||
a(slice('ABC\x1b[41mDEF\x1b[49m', 0, 5), "ABC\x1b[41mDE\x1b[49m",
|
||||
"Save styles when chopping part of the backcolor-styled string");
|
||||
a(slice('ABC\x1b[41mDEF\x1b[49m', 1, 4), "BC\x1b[41mD\x1b[49m",
|
||||
"Save styles when chopping part of the backcolor-styled string");
|
||||
a(slice('ABC\x1b[41mDEF\x1b[49m', 1, 6), "BC\x1b[41mDEF\x1b[49m",
|
||||
"Save styles when chopping part of the backcolor-styled string");
|
||||
a(slice('ABC\x1b[41mDEF\x1b[49m', -5, -1), "BC\x1b[41mDE\x1b[49m",
|
||||
"Save styles when chopping part of the backcolor-styled string");
|
||||
|
||||
a(slice('\x1b[1mAAA\x1b[31mBBB\x1b[39mAAA\x1b[22m', 0, 5), "\x1b[1mAAA\x1b[31mBB\x1b[39m\x1b[22m",
|
||||
"Works with nested styles #1");
|
||||
a(slice('\x1b[1mAAA\x1b[31mBBB\x1b[39mAAA\x1b[22m', 2, 7), "\x1b[1mA\x1b[31mBBB\x1b[39mA\x1b[22m",
|
||||
"Works with nested styles #2");
|
||||
a(slice('\x1b[3mAAA\x1b[41mBBB\x1b[49mAAA\x1b[23m', 0, 5), "\x1b[3mAAA\x1b[41mBB\x1b[49m\x1b[23m",
|
||||
"Works with nested styles #3");
|
||||
a(slice('\x1b[3mAAA\x1b[41mBBB\x1b[49mAAA\x1b[23m', 2, 7), "\x1b[3mA\x1b[41mBBB\x1b[49mA\x1b[23m",
|
||||
"Works with nested styles #4");
|
||||
a(slice('\x1b[3mAAA\x1b[41mBBB\x1b[49mAAA\x1b[23m', -8, -1),
|
||||
"\x1b[3mAA\x1b[41mBBB\x1b[49mAA\x1b[23m",
|
||||
"Works with nested styles #5");
|
||||
|
||||
a(slice('\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m', 0, 5),
|
||||
"\x1b[31mAAA\x1b[32mBB\x1b[39m",
|
||||
"Works with nested overlapping styles #1");
|
||||
a(slice('\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m', 2, 7),
|
||||
"\x1b[31mA\x1b[32mBBB\x1b[31mA\x1b[39m",
|
||||
"Works with nested overlapping styles #2");
|
||||
a(slice('\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m', -8, -1),
|
||||
"\x1b[31mAA\x1b[32mBBB\x1b[31mAA\x1b[39m",
|
||||
"Works with nested overlapping styles #3");
|
||||
|
||||
/* CSI at the edge of slice */
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', 3), "\x1b[31mDEF\x1b[39m", "Does not corrupt start CSI");
|
||||
a(slice('\x1b[41mABC\x1b[49mDEF', 0, 3), "\x1b[41mABC\x1b[49m", "Does not corrupt end CSI");
|
||||
|
||||
/* CSI-reducing tests */
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', 0, 3), "ABC", "Does not mixin CSI to plain string");
|
||||
a(slice('ABCD\x1b[31mEF\x1b[39m', 0, 3), "ABC", "Does not mixin CSI to plain string");
|
||||
a(slice('\x1b[41mABC\x1b[49mDEF', 3), "DEF", "Does not mixin CSI to plain string");
|
||||
a(slice('\x1b[41mAB\x1b[49mCDEF', 3), "DEF", "Does not mixin CSI to plain string");
|
||||
|
||||
a(slice('A\x1b[31mBBB\x1b[39mD\x1b[32mE\x1b[39m', 2, 3), "\x1b[31mB\x1b[39m",
|
||||
"Does slice with surrounding styles");
|
||||
a(slice('A\x1b[31mBBB\x1b[39mD\x1b[32mE\x1b[39m', 0, 5), "A\x1b[31mBBB\x1b[39mD",
|
||||
"Does slice with inner styles");
|
||||
|
||||
a(slice('A\x1b[31mBBB\x1b[39m\x1b[2J\x1b[0;0H', 0, 4), "A\x1b[31mBBB\x1b[39m",
|
||||
"Remove reset CSI");
|
||||
|
||||
// 'A' + clc.red('BBB') + clc.erase.screen + clc.move.to(0, 0)
|
||||
a(slice('A\u001b[31mBBB\u001b[39m\u001b[2J\u001b[1;1H', 0, 4), "A\x1b[31mBBB\x1b[39m",
|
||||
"Remove control CSIs");
|
||||
};
|
||||
98
node_modules/cli-color/test/strip.js
generated
vendored
Normal file
98
node_modules/cli-color/test/strip.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
'use strict';
|
||||
|
||||
var clc = require('../');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = clc.red
|
||||
, y = x.bold;
|
||||
|
||||
a(t('test'), 'test', "Plain");
|
||||
|
||||
a(t('\x1bA'), '', "Simple Command Type 1");
|
||||
a(t('\x9bA'), '', "Simple Command Type 2");
|
||||
|
||||
a(t('\x1b[0A'), '', "Single Command");
|
||||
a(t('\x1b[0;A'), '', "Single Separated Command");
|
||||
a(t('\x1b[0;0A'), '', "Two Commands");
|
||||
a(t('\x1b[0;0;A'), '', "Two Separated Commands");
|
||||
|
||||
// Base on index tests.
|
||||
a(t(clc.red('foo')), 'foo', "Foreground");
|
||||
a(t(clc.red('foo', 'bar', 3)), 'foo bar 3', "Foreground: Many args");
|
||||
a(t(clc.red.yellow('foo', 'bar', 3)), 'foo bar 3', "Foreground: Overriden");
|
||||
a(t(clc.bgRed('foo', 'bar')), 'foo bar', "Background");
|
||||
a(t(clc.bgRed.bgYellow('foo', 'bar', 3)), 'foo bar 3', "Background: Overriden");
|
||||
|
||||
a(t(clc.blue.bgYellow('foo', 'bar')), 'foo bar', "Foreground & Background");
|
||||
a(t(clc.blue.bgYellow.red.bgMagenta('foo', 'bar')),
|
||||
'foo bar',
|
||||
"Foreground & Background: Overriden");
|
||||
|
||||
a(t(clc.bold('foo', 'bar')), 'foo bar', "Format");
|
||||
a(t(clc.blink('foobar')), 'foobar', "Format: blink");
|
||||
a(t(clc.bold.blue('foo', 'bar', 3)), 'foo bar 3', "Foreground & Format");
|
||||
|
||||
a(t(clc.redBright('foo', 'bar')), 'foo bar', "Bright");
|
||||
a(t(clc.bgRedBright('foo', 3)), 'foo 3', "Bright background");
|
||||
|
||||
a(t(clc.blueBright.bgYellowBright.red.bgMagenta('foo', 'bar')),
|
||||
'foo bar',
|
||||
"Foreground & Background: Bright: Overriden");
|
||||
|
||||
a(t(clc.red.blue('foo')), 'foo', "Prioritize the Last Color: Blue");
|
||||
a(t(clc.blue.red('foo')), 'foo', "Prioritize the Last Color: Red");
|
||||
a(t(clc.bgRed.bgBlue('foo')), 'foo', "Prioritize the Last Background Color: Blue");
|
||||
a(t(clc.bgBlue.bgRed('foo')), 'foo', "Prioritize the Last Background Color: Red");
|
||||
a(t(clc.bgRed.red.bgBlue.blue('foo')), 'foo', "Prioritize the Last Mixed Style: Blue");
|
||||
a(t(clc.bgBlue.blue.bgRed.red('foo')), 'foo', "Prioritize the Last Mixed Style: Red");
|
||||
a(t(clc.bgRed.blue.bgBlue.red('foo')),
|
||||
'foo',
|
||||
"Prioritize the Last Mixed Style: BG Blue and Red");
|
||||
a(t(clc.bgBlue.red.bgRed.blue('foo')),
|
||||
'foo',
|
||||
"Prioritize the Last Mixed Style: BG Red and Blue");
|
||||
|
||||
a(t(x('foo', 'red') + ' ' + y('foo', 'boldred')),
|
||||
'foo red foo boldred',
|
||||
"Detached extension");
|
||||
|
||||
a(t(clc.erase.screen).replace(/\n/g, ''), '', "Reset");
|
||||
|
||||
a(t(clc.move.up()), '', "Up: No argument");
|
||||
a(t(clc.move.up({})), '', "Up: Not a number");
|
||||
a(t(clc.move.up(-34)), '', "Up: Negative");
|
||||
a(t(clc.move.up(34)), '', "Up: Positive");
|
||||
|
||||
a(t(clc.move.down()), '', "Down: No argument");
|
||||
a(t(clc.move.down({})), '', "Down: Not a number");
|
||||
a(t(clc.move.down(-34)), '', "Down: Negative");
|
||||
a(t(clc.move.down(34)), '', "Down: Positive");
|
||||
|
||||
a(t(clc.move.right()), '', "Right: No argument");
|
||||
a(t(clc.move.right({})), '', "Right: Not a number");
|
||||
a(t(clc.move.right(-34)), '', "Right: Negative");
|
||||
a(t(clc.move.right(34)), '', "Right: Positive");
|
||||
|
||||
a(t(clc.move.left()), '', "Left: No argument");
|
||||
a(t(clc.move.left({})), '', "Left: Not a number");
|
||||
a(t(clc.move.left(-34)), '', "Left: Negative");
|
||||
a(t(clc.move.left(34)), '', "Left: Positive");
|
||||
|
||||
a(t(clc.move()), '', "Move: No arguments");
|
||||
a(t(clc.move({}, {})), '', "Move: Bad arguments");
|
||||
a(t(clc.move({}, 12)), '', "Move: One direction");
|
||||
a(t(clc.move(0, -12)), '', "Move: One negative direction");
|
||||
a(t(clc.move(-42, -2)), '', "Move: two negatives");
|
||||
a(t(clc.move(2, 35)), '', "Move: two positives");
|
||||
|
||||
a(t(clc.move.to()), '', "MoveTo: No arguments");
|
||||
a(t(clc.move.to({}, {})), '', "MoveTo: Bad arguments");
|
||||
a(t(clc.move.to({}, 12)), '', "MoveTo: One direction");
|
||||
a(t(clc.move.to(2, -12)), '', "MoveTo: One negative direction");
|
||||
a(t(clc.move.to(-42, -2)), '', "MoveTo: two negatives");
|
||||
a(t(clc.move.to(2, 35)), '', "MoveTo: two positives");
|
||||
|
||||
a(t(clc.beep), clc.beep, "Beep");
|
||||
|
||||
a(t('test'), 'test', "Plain");
|
||||
};
|
||||
45
node_modules/cli-color/test/throbber.js
generated
vendored
Normal file
45
node_modules/cli-color/test/throbber.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
var startsWith = require('es5-ext/string/#/starts-with')
|
||||
, spawn = require('child_process').spawn
|
||||
, resolve = require('path').resolve
|
||||
, pg = resolve(__dirname, '__playground');
|
||||
|
||||
module.exports = {
|
||||
"": function (a, d) {
|
||||
var t = spawn('node', [resolve(pg, 'throbber.js')])
|
||||
, out = [], err = '';
|
||||
|
||||
t.stdout.on('data', function (data) {
|
||||
out.push(data);
|
||||
});
|
||||
t.stderr.on('data', function (data) {
|
||||
err += data;
|
||||
});
|
||||
t.on('exit', function () {
|
||||
a.ok(out.length > 4, "Interval");
|
||||
a(startsWith.call(out.join(""), "START-\b\\\b|\b/\b-\b"), true, "Output");
|
||||
a(err, "", "No stderr output");
|
||||
d();
|
||||
});
|
||||
},
|
||||
Formatted: function (a, d) {
|
||||
var t = spawn('node', [resolve(pg, 'throbber.formatted.js')])
|
||||
, out = [], err = '';
|
||||
|
||||
t.stdout.on('data', function (data) {
|
||||
out.push(data);
|
||||
});
|
||||
t.stderr.on('data', function (data) {
|
||||
err += data;
|
||||
});
|
||||
t.on('exit', function () {
|
||||
a.ok(out.length > 4, "Interval");
|
||||
a(startsWith.call(out.join(""), "START\x1b[31m-\x1b[39m\x1b[31m\b\\\x1b" +
|
||||
"[39m\x1b[31m\b|\x1b[39m\x1b[31m\b/\x1b[39m\x1b[31m\b-\x1b[39m"),
|
||||
true, "Output");
|
||||
a(err, "", "No stderr output");
|
||||
d();
|
||||
});
|
||||
}
|
||||
};
|
||||
124
node_modules/cli-color/test/visual.js
generated
vendored
Normal file
124
node_modules/cli-color/test/visual.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
'use strict';
|
||||
|
||||
var clc = require('./')
|
||||
|
||||
, colors = [ 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white' ];
|
||||
|
||||
// Write some message.
|
||||
function w(message) {
|
||||
process.stdout.write(message);
|
||||
}
|
||||
|
||||
// Print colors.
|
||||
function printColors(title, style) {
|
||||
var j = colors.length
|
||||
, color
|
||||
, colorText
|
||||
, tint
|
||||
, i;
|
||||
|
||||
w(' > ' + clc.whiteBright(title) + ' ');
|
||||
for (i = 0; i < j; i++) {
|
||||
tint = clc;
|
||||
color = colors[i];
|
||||
colorText = color.toUpperCase();
|
||||
|
||||
if (style === 'foreground') {
|
||||
tint = tint[color];
|
||||
|
||||
if (color === 'black') {
|
||||
tint = tint.bgBlackBright;
|
||||
}
|
||||
}
|
||||
|
||||
if (style === 'foregroundBright') {
|
||||
tint = tint[color + 'Bright'];
|
||||
}
|
||||
|
||||
if (style === 'background') {
|
||||
tint = tint['bg' + color.slice(0, 1).toUpperCase() + color.slice(1)];
|
||||
|
||||
if (color === 'white') {
|
||||
tint = tint.whiteBright;
|
||||
}
|
||||
}
|
||||
|
||||
if (style === 'backgroundBright') {
|
||||
tint = tint['bg' + color.slice(0, 1).toUpperCase() + color.slice(1) + 'Bright'];
|
||||
}
|
||||
|
||||
w(tint(colorText) + ' ');
|
||||
}
|
||||
w('\n');
|
||||
}
|
||||
|
||||
// Smile test.
|
||||
w(clc.reset);
|
||||
|
||||
w('\n SMILE TEST\n\n');
|
||||
|
||||
// Yellow face.
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
|
||||
// Move blue eyes.
|
||||
w(clc.move(7, -5));
|
||||
w(clc.blueBright.bgYellowBright("O"));
|
||||
w(clc.move(1, 0));
|
||||
w(clc.blueBright.bgYellowBright("O"));
|
||||
|
||||
// Red nose.
|
||||
w(clc.move.to(8, 5));
|
||||
w(clc.redBright.bgYellowBright("\u25A0"));
|
||||
|
||||
// Red mouth.
|
||||
w(clc.move.down(2));
|
||||
w(clc.move.left(2));
|
||||
w(clc.red.bgYellowBright("\u2588\u2584\u2588"));
|
||||
|
||||
// Move back.
|
||||
w(clc.move.to(0, 9));
|
||||
|
||||
// Colors test.
|
||||
w('\n COLORS TESTS\n');
|
||||
printColors('FOREGROUNDS (DEFAULT)', 'foreground');
|
||||
printColors('FOREGROUNDS (BRIGHT) ', 'foregroundBright');
|
||||
printColors('BACKGROUNDS (DEFAULT)', 'background');
|
||||
printColors('BACKGROUNDS (BRIGHT) ', 'backgroundBright');
|
||||
|
||||
// // Art test.
|
||||
w('\n ART TESTS\n\n');
|
||||
w(clc.art('\t.01111111112.\n' +
|
||||
'\t.3.........3.\n' +
|
||||
'\t.3.........3.\n' +
|
||||
'\t.41111111115.\n', {
|
||||
"0": clc.bgBlue.yellowBright('\u2554'),
|
||||
"1": clc.bgBlue.yellowBright('\u2550'),
|
||||
"2": clc.bgBlue.yellowBright('\u2557'),
|
||||
"3": clc.bgBlue.yellowBright('\u2551'),
|
||||
"4": clc.bgBlue.yellowBright('\u255A'),
|
||||
"5": clc.bgBlue.yellowBright('\u255D'),
|
||||
".": clc.bgBlue(' ')
|
||||
}));
|
||||
w(clc.move(11, -3));
|
||||
w(clc.bgBlue.whiteBright("Hello"));
|
||||
w(clc.move(-3, 1));
|
||||
w(clc.bgBlue.whiteBright("World"));
|
||||
w(clc.move(0, 2));
|
||||
w('\n');
|
||||
8
node_modules/cli-color/test/window-size.js
generated
vendored
Normal file
8
node_modules/cli-color/test/window-size.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t.width, 'number', "Width");
|
||||
a(typeof t.height, 'number', "Height");
|
||||
a(t.width > 0, true);
|
||||
a(t.height > 0, true);
|
||||
};
|
||||
50
node_modules/cli-color/throbber.js
generated
vendored
Normal file
50
node_modules/cli-color/throbber.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
var compose = require('es5-ext/function/#/compose')
|
||||
, callable = require('es5-ext/object/valid-callable')
|
||||
, d = require('d')
|
||||
, validTimeout = require('timers-ext/valid-timeout')
|
||||
|
||||
, chars = '-\\|/', l = chars.length, ThrobberIterator;
|
||||
|
||||
ThrobberIterator = function () {};
|
||||
Object.defineProperties(ThrobberIterator.prototype, {
|
||||
index: d(-1),
|
||||
running: d(false),
|
||||
next: d(function () {
|
||||
var str = this.running ? '\u0008' : '';
|
||||
if (!this.running) this.running = true;
|
||||
return str + chars[this.index = ((this.index + 1) % l)];
|
||||
}),
|
||||
reset: d(function () {
|
||||
if (!this.running) return '';
|
||||
this.index = -1;
|
||||
this.running = false;
|
||||
return '\u0008';
|
||||
})
|
||||
});
|
||||
|
||||
module.exports = exports = function (write, interval/*, format*/) {
|
||||
var format = arguments[2], token, iterator = new ThrobberIterator();
|
||||
callable(write);
|
||||
interval = validTimeout(interval);
|
||||
if (format !== undefined) write = compose.call(write, callable(format));
|
||||
return {
|
||||
start: function () {
|
||||
if (token) return;
|
||||
token = setInterval(function () { write(iterator.next()); }, interval);
|
||||
},
|
||||
restart: function () {
|
||||
this.stop();
|
||||
this.start();
|
||||
},
|
||||
stop: function () {
|
||||
if (!token) return;
|
||||
clearInterval(token);
|
||||
token = null;
|
||||
write(iterator.reset());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Object.defineProperty(exports, 'Iterator', d(ThrobberIterator));
|
||||
8
node_modules/cli-color/window-size.js
generated
vendored
Normal file
8
node_modules/cli-color/window-size.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var d = require('d');
|
||||
|
||||
Object.defineProperties(exports, {
|
||||
width: d.gs('ce', function () { return process.stdout.columns || 0; }),
|
||||
height: d.gs('ce', function () { return process.stdout.rows || 0; })
|
||||
});
|
||||
Reference in New Issue
Block a user