the-grid-cc 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/01-SUMMARY.md +95 -0
- package/README.md +31 -13
- package/assets/terminal.svg +74 -0
- package/commands/grid/VERSION +1 -1
- package/package.json +1 -1
- package/tools/grid-viz/PLAN.md +235 -0
- package/tools/grid-viz/README.md +84 -0
- package/tools/grid-viz/VERIFICATION.md +197 -0
- package/tools/grid-viz/grid-viz.js +248 -0
- package/tools/grid-viz/node_modules/.package-lock.json +78 -0
- package/tools/grid-viz/node_modules/ansi-styles/index.d.ts +345 -0
- package/tools/grid-viz/node_modules/ansi-styles/index.js +163 -0
- package/tools/grid-viz/node_modules/ansi-styles/license +9 -0
- package/tools/grid-viz/node_modules/ansi-styles/package.json +56 -0
- package/tools/grid-viz/node_modules/ansi-styles/readme.md +152 -0
- package/tools/grid-viz/node_modules/chalk/index.d.ts +415 -0
- package/tools/grid-viz/node_modules/chalk/license +9 -0
- package/tools/grid-viz/node_modules/chalk/package.json +68 -0
- package/tools/grid-viz/node_modules/chalk/readme.md +341 -0
- package/tools/grid-viz/node_modules/chalk/source/index.js +229 -0
- package/tools/grid-viz/node_modules/chalk/source/templates.js +134 -0
- package/tools/grid-viz/node_modules/chalk/source/util.js +39 -0
- package/tools/grid-viz/node_modules/color-convert/CHANGELOG.md +54 -0
- package/tools/grid-viz/node_modules/color-convert/LICENSE +21 -0
- package/tools/grid-viz/node_modules/color-convert/README.md +68 -0
- package/tools/grid-viz/node_modules/color-convert/conversions.js +839 -0
- package/tools/grid-viz/node_modules/color-convert/index.js +81 -0
- package/tools/grid-viz/node_modules/color-convert/package.json +48 -0
- package/tools/grid-viz/node_modules/color-convert/route.js +97 -0
- package/tools/grid-viz/node_modules/color-name/LICENSE +8 -0
- package/tools/grid-viz/node_modules/color-name/README.md +11 -0
- package/tools/grid-viz/node_modules/color-name/index.js +152 -0
- package/tools/grid-viz/node_modules/color-name/package.json +28 -0
- package/tools/grid-viz/node_modules/has-flag/index.d.ts +39 -0
- package/tools/grid-viz/node_modules/has-flag/index.js +8 -0
- package/tools/grid-viz/node_modules/has-flag/license +9 -0
- package/tools/grid-viz/node_modules/has-flag/package.json +46 -0
- package/tools/grid-viz/node_modules/has-flag/readme.md +89 -0
- package/tools/grid-viz/node_modules/supports-color/browser.js +5 -0
- package/tools/grid-viz/node_modules/supports-color/index.js +135 -0
- package/tools/grid-viz/node_modules/supports-color/license +9 -0
- package/tools/grid-viz/node_modules/supports-color/package.json +53 -0
- package/tools/grid-viz/node_modules/supports-color/readme.md +76 -0
- package/tools/grid-viz/package-lock.json +89 -0
- package/tools/grid-viz/package.json +23 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const stringReplaceAll = (string, substring, replacer) => {
|
|
4
|
+
let index = string.indexOf(substring);
|
|
5
|
+
if (index === -1) {
|
|
6
|
+
return string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const substringLength = substring.length;
|
|
10
|
+
let endIndex = 0;
|
|
11
|
+
let returnValue = '';
|
|
12
|
+
do {
|
|
13
|
+
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
14
|
+
endIndex = index + substringLength;
|
|
15
|
+
index = string.indexOf(substring, endIndex);
|
|
16
|
+
} while (index !== -1);
|
|
17
|
+
|
|
18
|
+
returnValue += string.substr(endIndex);
|
|
19
|
+
return returnValue;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
|
23
|
+
let endIndex = 0;
|
|
24
|
+
let returnValue = '';
|
|
25
|
+
do {
|
|
26
|
+
const gotCR = string[index - 1] === '\r';
|
|
27
|
+
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
|
28
|
+
endIndex = index + 1;
|
|
29
|
+
index = string.indexOf('\n', endIndex);
|
|
30
|
+
} while (index !== -1);
|
|
31
|
+
|
|
32
|
+
returnValue += string.substr(endIndex);
|
|
33
|
+
return returnValue;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
stringReplaceAll,
|
|
38
|
+
stringEncaseCRLFWithFirstIndex
|
|
39
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# 1.0.0 - 2016-01-07
|
|
2
|
+
|
|
3
|
+
- Removed: unused speed test
|
|
4
|
+
- Added: Automatic routing between previously unsupported conversions
|
|
5
|
+
([#27](https://github.com/Qix-/color-convert/pull/27))
|
|
6
|
+
- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
|
|
7
|
+
([#27](https://github.com/Qix-/color-convert/pull/27))
|
|
8
|
+
- Removed: `convert()` class
|
|
9
|
+
([#27](https://github.com/Qix-/color-convert/pull/27))
|
|
10
|
+
- Changed: all functions to lookup dictionary
|
|
11
|
+
([#27](https://github.com/Qix-/color-convert/pull/27))
|
|
12
|
+
- Changed: `ansi` to `ansi256`
|
|
13
|
+
([#27](https://github.com/Qix-/color-convert/pull/27))
|
|
14
|
+
- Fixed: argument grouping for functions requiring only one argument
|
|
15
|
+
([#27](https://github.com/Qix-/color-convert/pull/27))
|
|
16
|
+
|
|
17
|
+
# 0.6.0 - 2015-07-23
|
|
18
|
+
|
|
19
|
+
- Added: methods to handle
|
|
20
|
+
[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
|
|
21
|
+
- rgb2ansi16
|
|
22
|
+
- rgb2ansi
|
|
23
|
+
- hsl2ansi16
|
|
24
|
+
- hsl2ansi
|
|
25
|
+
- hsv2ansi16
|
|
26
|
+
- hsv2ansi
|
|
27
|
+
- hwb2ansi16
|
|
28
|
+
- hwb2ansi
|
|
29
|
+
- cmyk2ansi16
|
|
30
|
+
- cmyk2ansi
|
|
31
|
+
- keyword2ansi16
|
|
32
|
+
- keyword2ansi
|
|
33
|
+
- ansi162rgb
|
|
34
|
+
- ansi162hsl
|
|
35
|
+
- ansi162hsv
|
|
36
|
+
- ansi162hwb
|
|
37
|
+
- ansi162cmyk
|
|
38
|
+
- ansi162keyword
|
|
39
|
+
- ansi2rgb
|
|
40
|
+
- ansi2hsl
|
|
41
|
+
- ansi2hsv
|
|
42
|
+
- ansi2hwb
|
|
43
|
+
- ansi2cmyk
|
|
44
|
+
- ansi2keyword
|
|
45
|
+
([#18](https://github.com/harthur/color-convert/pull/18))
|
|
46
|
+
|
|
47
|
+
# 0.5.3 - 2015-06-02
|
|
48
|
+
|
|
49
|
+
- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
|
|
50
|
+
([#15](https://github.com/harthur/color-convert/issues/15))
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
Check out commit logs for older releases
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# color-convert
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/Qix-/color-convert)
|
|
4
|
+
|
|
5
|
+
Color-convert is a color conversion library for JavaScript and node.
|
|
6
|
+
It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
var convert = require('color-convert');
|
|
10
|
+
|
|
11
|
+
convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
|
|
12
|
+
convert.keyword.rgb('blue'); // [0, 0, 255]
|
|
13
|
+
|
|
14
|
+
var rgbChannels = convert.rgb.channels; // 3
|
|
15
|
+
var cmykChannels = convert.cmyk.channels; // 4
|
|
16
|
+
var ansiChannels = convert.ansi16.channels; // 1
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
# Install
|
|
20
|
+
|
|
21
|
+
```console
|
|
22
|
+
$ npm install color-convert
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
# API
|
|
26
|
+
|
|
27
|
+
Simply get the property of the _from_ and _to_ conversion that you're looking for.
|
|
28
|
+
|
|
29
|
+
All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
|
|
30
|
+
|
|
31
|
+
All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
var convert = require('color-convert');
|
|
35
|
+
|
|
36
|
+
// Hex to LAB
|
|
37
|
+
convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
|
|
38
|
+
convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
|
|
39
|
+
|
|
40
|
+
// RGB to CMYK
|
|
41
|
+
convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
|
|
42
|
+
convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Arrays
|
|
46
|
+
All functions that accept multiple arguments also support passing an array.
|
|
47
|
+
|
|
48
|
+
Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
var convert = require('color-convert');
|
|
52
|
+
|
|
53
|
+
convert.rgb.hex(123, 45, 67); // '7B2D43'
|
|
54
|
+
convert.rgb.hex([123, 45, 67]); // '7B2D43'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Routing
|
|
58
|
+
|
|
59
|
+
Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
|
|
60
|
+
|
|
61
|
+
Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
|
|
62
|
+
|
|
63
|
+
# Contribute
|
|
64
|
+
|
|
65
|
+
If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
|
|
66
|
+
|
|
67
|
+
# License
|
|
68
|
+
Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
|