aboutsummaryrefslogtreecommitdiff
path: root/node_modules/ansi-styles
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2019-10-06 21:37:45 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2019-10-06 21:37:45 +0200
commit3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 (patch)
treec7ccc8279b12c4f7bdbbb4270d617e48f51722e4 /node_modules/ansi-styles
parent412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff)
downloadwebsite-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz
website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip
build: Add some required modules for node
Diffstat (limited to 'node_modules/ansi-styles')
-rw-r--r--node_modules/ansi-styles/index.js165
-rw-r--r--node_modules/ansi-styles/license9
-rw-r--r--node_modules/ansi-styles/package.json92
-rw-r--r--node_modules/ansi-styles/readme.md147
4 files changed, 413 insertions, 0 deletions
diff --git a/node_modules/ansi-styles/index.js b/node_modules/ansi-styles/index.js
new file mode 100644
index 0000000..90a871c
--- /dev/null
+++ b/node_modules/ansi-styles/index.js
@@ -0,0 +1,165 @@
+'use strict';
+const colorConvert = require('color-convert');
+
+const wrapAnsi16 = (fn, offset) => function () {
+ const code = fn.apply(colorConvert, arguments);
+ return `\u001B[${code + offset}m`;
+};
+
+const wrapAnsi256 = (fn, offset) => function () {
+ const code = fn.apply(colorConvert, arguments);
+ return `\u001B[${38 + offset};5;${code}m`;
+};
+
+const wrapAnsi16m = (fn, offset) => function () {
+ const rgb = fn.apply(colorConvert, arguments);
+ return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
+};
+
+function assembleStyles() {
+ const codes = new Map();
+ const styles = {
+ modifier: {
+ reset: [0, 0],
+ // 21 isn't widely supported and 22 does the same thing
+ bold: [1, 22],
+ dim: [2, 22],
+ italic: [3, 23],
+ underline: [4, 24],
+ inverse: [7, 27],
+ hidden: [8, 28],
+ strikethrough: [9, 29]
+ },
+ color: {
+ black: [30, 39],
+ red: [31, 39],
+ green: [32, 39],
+ yellow: [33, 39],
+ blue: [34, 39],
+ magenta: [35, 39],
+ cyan: [36, 39],
+ white: [37, 39],
+ gray: [90, 39],
+
+ // Bright color
+ redBright: [91, 39],
+ greenBright: [92, 39],
+ yellowBright: [93, 39],
+ blueBright: [94, 39],
+ magentaBright: [95, 39],
+ cyanBright: [96, 39],
+ whiteBright: [97, 39]
+ },
+ bgColor: {
+ bgBlack: [40, 49],
+ bgRed: [41, 49],
+ bgGreen: [42, 49],
+ bgYellow: [43, 49],
+ bgBlue: [44, 49],
+ bgMagenta: [45, 49],
+ bgCyan: [46, 49],
+ bgWhite: [47, 49],
+
+ // Bright color
+ bgBlackBright: [100, 49],
+ bgRedBright: [101, 49],
+ bgGreenBright: [102, 49],
+ bgYellowBright: [103, 49],
+ bgBlueBright: [104, 49],
+ bgMagentaBright: [105, 49],
+ bgCyanBright: [106, 49],
+ bgWhiteBright: [107, 49]
+ }
+ };
+
+ // Fix humans
+ styles.color.grey = styles.color.gray;
+
+ for (const groupName of Object.keys(styles)) {
+ const group = styles[groupName];
+
+ for (const styleName of Object.keys(group)) {
+ const style = group[styleName];
+
+ styles[styleName] = {
+ open: `\u001B[${style[0]}m`,
+ close: `\u001B[${style[1]}m`
+ };
+
+ group[styleName] = styles[styleName];
+
+ codes.set(style[0], style[1]);
+ }
+
+ Object.defineProperty(styles, groupName, {
+ value: group,
+ enumerable: false
+ });
+
+ Object.defineProperty(styles, 'codes', {
+ value: codes,
+ enumerable: false
+ });
+ }
+
+ const ansi2ansi = n => n;
+ const rgb2rgb = (r, g, b) => [r, g, b];
+
+ styles.color.close = '\u001B[39m';
+ styles.bgColor.close = '\u001B[49m';
+
+ styles.color.ansi = {
+ ansi: wrapAnsi16(ansi2ansi, 0)
+ };
+ styles.color.ansi256 = {
+ ansi256: wrapAnsi256(ansi2ansi, 0)
+ };
+ styles.color.ansi16m = {
+ rgb: wrapAnsi16m(rgb2rgb, 0)
+ };
+
+ styles.bgColor.ansi = {
+ ansi: wrapAnsi16(ansi2ansi, 10)
+ };
+ styles.bgColor.ansi256 = {
+ ansi256: wrapAnsi256(ansi2ansi, 10)
+ };
+ styles.bgColor.ansi16m = {
+ rgb: wrapAnsi16m(rgb2rgb, 10)
+ };
+
+ for (let key of Object.keys(colorConvert)) {
+ if (typeof colorConvert[key] !== 'object') {
+ continue;
+ }
+
+ const suite = colorConvert[key];
+
+ if (key === 'ansi16') {
+ key = 'ansi';
+ }
+
+ if ('ansi16' in suite) {
+ styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
+ styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
+ }
+
+ if ('ansi256' in suite) {
+ styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
+ styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
+ }
+
+ if ('rgb' in suite) {
+ styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
+ styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
+ }
+ }
+
+ return styles;
+}
+
+// Make the export immutable
+Object.defineProperty(module, 'exports', {
+ enumerable: true,
+ get: assembleStyles
+});
diff --git a/node_modules/ansi-styles/license b/node_modules/ansi-styles/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/node_modules/ansi-styles/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
diff --git a/node_modules/ansi-styles/package.json b/node_modules/ansi-styles/package.json
new file mode 100644
index 0000000..27780f9
--- /dev/null
+++ b/node_modules/ansi-styles/package.json
@@ -0,0 +1,92 @@
+{
+ "_args": [
+ [
+ "ansi-styles@3.2.1",
+ "/home/dstaesse/git/website"
+ ]
+ ],
+ "_development": true,
+ "_from": "ansi-styles@3.2.1",
+ "_id": "ansi-styles@3.2.1",
+ "_inBundle": false,
+ "_integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "_location": "/ansi-styles",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "ansi-styles@3.2.1",
+ "name": "ansi-styles",
+ "escapedName": "ansi-styles",
+ "rawSpec": "3.2.1",
+ "saveSpec": null,
+ "fetchSpec": "3.2.1"
+ },
+ "_requiredBy": [
+ "/chalk"
+ ],
+ "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "_spec": "3.2.1",
+ "_where": "/home/dstaesse/git/website",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "ava": {
+ "require": "babel-polyfill"
+ },
+ "bugs": {
+ "url": "https://github.com/chalk/ansi-styles/issues"
+ },
+ "dependencies": {
+ "color-convert": "^1.9.0"
+ },
+ "description": "ANSI escape codes for styling strings in the terminal",
+ "devDependencies": {
+ "ava": "*",
+ "babel-polyfill": "^6.23.0",
+ "svg-term-cli": "^2.1.1",
+ "xo": "*"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "files": [
+ "index.js"
+ ],
+ "homepage": "https://github.com/chalk/ansi-styles#readme",
+ "keywords": [
+ "ansi",
+ "styles",
+ "color",
+ "colour",
+ "colors",
+ "terminal",
+ "console",
+ "cli",
+ "string",
+ "tty",
+ "escape",
+ "formatting",
+ "rgb",
+ "256",
+ "shell",
+ "xterm",
+ "log",
+ "logging",
+ "command-line",
+ "text"
+ ],
+ "license": "MIT",
+ "name": "ansi-styles",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/chalk/ansi-styles.git"
+ },
+ "scripts": {
+ "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
+ "test": "xo && ava"
+ },
+ "version": "3.2.1"
+}
diff --git a/node_modules/ansi-styles/readme.md b/node_modules/ansi-styles/readme.md
new file mode 100644
index 0000000..3158e2d
--- /dev/null
+++ b/node_modules/ansi-styles/readme.md
@@ -0,0 +1,147 @@
+# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
+
+> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
+
+You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
+
+<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
+
+
+## Install
+
+```
+$ npm install ansi-styles
+```
+
+
+## Usage
+
+```js
+const style = require('ansi-styles');
+
+console.log(`${style.green.open}Hello world!${style.green.close}`);
+
+
+// Color conversion between 16/256/truecolor
+// NOTE: If conversion goes to 16 colors or 256 colors, the original color
+// may be degraded to fit that color palette. This means terminals
+// that do not support 16 million colors will best-match the
+// original color.
+console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
+console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
+console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
+```
+
+## API
+
+Each style has an `open` and `close` property.
+
+
+## Styles
+
+### Modifiers
+
+- `reset`
+- `bold`
+- `dim`
+- `italic` *(Not widely supported)*
+- `underline`
+- `inverse`
+- `hidden`
+- `strikethrough` *(Not widely supported)*
+
+### Colors
+
+- `black`
+- `red`
+- `green`
+- `yellow`
+- `blue`
+- `magenta`
+- `cyan`
+- `white`
+- `gray` ("bright black")
+- `redBright`
+- `greenBright`
+- `yellowBright`
+- `blueBright`
+- `magentaBright`
+- `cyanBright`
+- `whiteBright`
+
+### Background colors
+
+- `bgBlack`
+- `bgRed`
+- `bgGreen`
+- `bgYellow`
+- `bgBlue`
+- `bgMagenta`
+- `bgCyan`
+- `bgWhite`
+- `bgBlackBright`
+- `bgRedBright`
+- `bgGreenBright`
+- `bgYellowBright`
+- `bgBlueBright`
+- `bgMagentaBright`
+- `bgCyanBright`
+- `bgWhiteBright`
+
+
+## Advanced usage
+
+By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
+
+- `style.modifier`
+- `style.color`
+- `style.bgColor`
+
+###### Example
+
+```js
+console.log(style.color.green.open);
+```
+
+Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
+
+###### Example
+
+```js
+console.log(style.codes.get(36));
+//=> 39
+```
+
+
+## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
+
+`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
+
+To use these, call the associated conversion function with the intended output, for example:
+
+```js
+style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
+style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
+
+style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
+style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
+
+style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
+style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
+```
+
+
+## Related
+
+- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
+
+
+## Maintainers
+
+- [Sindre Sorhus](https://github.com/sindresorhus)
+- [Josh Junon](https://github.com/qix-)
+
+
+## License
+
+MIT