diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-10-26 13:57:00 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-11-02 11:31:01 +0000 |
commit | 1943b3c2a1dcee36c233724fc4ee7613d71b9cf6 (patch) | |
tree | 8c1b5f12357025c197da5427ae02cfdc2f3570d6 /chromium/third_party/devtools-frontend/src/node_modules/colorette | |
parent | 21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (diff) | |
download | qtwebengine-chromium-1943b3c2a1dcee36c233724fc4ee7613d71b9cf6.tar.gz |
BASELINE: Update Chromium to 94.0.4606.111
Change-Id: I924781584def20fc800bedf6ff41fdb96c438193
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/devtools-frontend/src/node_modules/colorette')
-rw-r--r-- | chromium/third_party/devtools-frontend/src/node_modules/colorette/README.md | 115 | ||||
-rw-r--r-- | chromium/third_party/devtools-frontend/src/node_modules/colorette/index.d.ts (renamed from chromium/third_party/devtools-frontend/src/node_modules/colorette/colorette.d.ts) | 0 | ||||
-rw-r--r-- | chromium/third_party/devtools-frontend/src/node_modules/colorette/package.json | 39 |
3 files changed, 69 insertions, 85 deletions
diff --git a/chromium/third_party/devtools-frontend/src/node_modules/colorette/README.md b/chromium/third_party/devtools-frontend/src/node_modules/colorette/README.md index dde847539e5..9b5b00f9841 100644 --- a/chromium/third_party/devtools-frontend/src/node_modules/colorette/README.md +++ b/chromium/third_party/devtools-frontend/src/node_modules/colorette/README.md @@ -1,64 +1,83 @@ -# Colorette [![](https://img.shields.io/npm/v/colorette.svg?label=&color=2a64e6)](https://www.npmjs.org/package/colorette) +# Colorette -> Color your terminal using pure idiomatic JavaScript. +> Easily set the color and style of text in the terminal. -Colorette is a Node.js library for embellishing your CLI tools with colors and styles using [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code). - -- ~1.5x faster than alternatives ([run the benchmarks](#run-the-benchmarks)). -- No wonky prototype-based method chains. +- No wonky prototype method-chain API. - Automatic color support detection. -- ~80 LOC and no dependencies. -- [`NO_COLOR`](https://no-color.org) friendly. +- Up to [2x faster](#benchmarks) than alternatives. +- [`NO_COLOR`](https://no-color.org) friendly. 👌 -## Quickstart +Here's the first example to get you started. -```console -npm i colorette +```js +import { blue, bold, underline } from "colorette" + +console.log( + blue("I'm blue"), + bold(blue("da ba dee")), + underline(bold(blue("da ba daa"))) +) ``` -Import the [styles](#styles) you need. [Here](#supported-styles)'s the list of styles you can use. +Here's an example using [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals). ```js -import { red, blue, bold } from "colorette" +console.log(` + There's a ${underline(blue("house"))}, + With a ${bold(blue("window"))}, + And a ${blue("corvette")} + And everything is blue +`) ``` -Wrap your strings in one or more styles to produce the finish you're looking for. +Of course, you can nest styles without breaking existing color sequences. ```js -console.log(bold(blue("Engage!"))) +console.log(bold(`I'm ${blue(`da ba ${underline("dee")} da ba`)} daa`)) ``` -Mix it with [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) to interpolate variables, expressions and create multi-line strings easily. +Feeling adventurous? Try the [pipeline operator](https://github.com/tc39/proposal-pipeline-operator). ```js -console.log(` - Beets are ${red("red")}, - Plums are ${blue("blue")}, - ${bold("Colorette!")}. -`) +console.log("Da ba dee da ba daa" |> blue |> bold) ``` -Using `console.log`'s [string substitution](https://nodejs.org/api/console.html#console_console_log_data_args) can be useful too. +## Installation -```js -console.log(bold("Total: $%f"), 1.99) +```console +npm install colorette ``` -You can also nest styles without breaking existing escape codes. +## API + +### `<style>(string)` ```js -console.log(red(`Red Shirt ${blue("Blue Shirt")} Red Shirt`)) +import { blue } from "colorette" + +blue("I'm blue") //=> \x1b[34mI'm blue\x1b[39m ``` -Feeling adventurous? Try the [pipeline operator](https://github.com/tc39/proposal-pipeline-operator). +See [supported styles](). + +### `options.enabled` + +Colorette automatically detects if your terminal can display color, but you can toggle color as needed. ```js -console.log("Make it so!" |> bold |> blue) +import { options } from "colorette" + +options.enabled = false ``` -## Supported styles +You can also force the use of color globally by setting `FORCE_COLOR=` or `NO_COLOR=` from the CLI. -Colorette supports the standard and bright color variations out-of-the-box. See [this issue](https://github.com/jorgebucaran/colorette/issues/27) if you were looking for TrueColor support. +```console +$ FORCE_COLOR= node example.js >log +$ NO_COLOR= node example.js +``` + +## Supported styles | Colors | Background Colors | Bright Colors | Bright Background Colors | Modifiers | | ------- | ----------------- | ------------- | ------------------------ | ----------------- | @@ -66,46 +85,18 @@ Colorette supports the standard and bright color variations out-of-the-box. See | red | bgRed | redBright | bgRedBright | **bold** | | green | bgGreen | greenBright | bgGreenBright | hidden | | yellow | bgYellow | yellowBright | bgYellowBright | _italic_ | -| blue | bgBlue | blueBright | bgBlueBright | underline | +| blue | bgBlue | blueBright | bgBlueBright | <u>underline</u> | | magenta | bgMagenta | magentaBright | bgMagentaBright | ~~strikethrough~~ | | cyan | bgCyan | cyanBright | bgCyanBright | reset | | white | bgWhite | whiteBright | bgWhiteBright | | | gray | | | | | -## API - -### <code><i>style</i>(string)</code> - -Returns a string wrapped in the corresponding ANSI escape codes. - -```js -red("Red Alert") //=> \u001b[31mRed Alert\u001b[39m -``` - -### `options.enabled` - -Color will be enabled if your terminal supports it, `FORCE_COLOR` is defined in [`process.env`](https://nodejs.org/dist/latest-v8.x/docs/api/process.html#process_process_env) and if `NO_COLOR` isn't, but you can always override it if you want. - -```js -import { options } from "colorette" +## Benchmarks -options.enabled = false -``` - -## Run the benchmarks - -``` -npm i -C bench && node bench +```console +npm --prefix bench start ``` -<pre> -colorette × 759,429 ops/sec -chalk × 524,034 ops/sec -kleur × 490,347 ops/sec -colors × 255,661 ops/sec -ansi-colors × 317,605 ops/sec -</pre> - ## License [MIT](LICENSE.md) diff --git a/chromium/third_party/devtools-frontend/src/node_modules/colorette/colorette.d.ts b/chromium/third_party/devtools-frontend/src/node_modules/colorette/index.d.ts index f8aa6a05e27..f8aa6a05e27 100644 --- a/chromium/third_party/devtools-frontend/src/node_modules/colorette/colorette.d.ts +++ b/chromium/third_party/devtools-frontend/src/node_modules/colorette/index.d.ts diff --git a/chromium/third_party/devtools-frontend/src/node_modules/colorette/package.json b/chromium/third_party/devtools-frontend/src/node_modules/colorette/package.json index 9cfa5f8c4d9..25c144678e9 100644 --- a/chromium/third_party/devtools-frontend/src/node_modules/colorette/package.json +++ b/chromium/third_party/devtools-frontend/src/node_modules/colorette/package.json @@ -1,10 +1,13 @@ { "name": "colorette", - "version": "1.2.1", - "description": "Color your terminal using pure idiomatic JavaScript.", - "main": "index.cjs", + "version": "1.2.2", "type": "module", + "main": "index.cjs", "module": "index.js", + "types": "index.d.ts", + "description": "Easily set the color and style of text in the terminal.", + "repository": "jorgebucaran/colorette", + "license": "MIT", "exports": { "./package.json": "./package.json", ".": { @@ -12,35 +15,25 @@ "import": "./index.js" } }, - "types": "colorette.d.ts", - "scripts": { - "test": "c8 testmatrix test/*.cjs", - "build": "node -e \"fs.writeFileSync('index.cjs',fs.readFileSync('index.js','utf8').replace(/export const /g,'exports.'),'utf8')\"", - "release": "v=$npm_package_version; git commit -am $v && git tag -s $v -m $v && git push && git push --tags && npm publish" - }, - "repository": { - "type": "git", - "url": "jorgebucaran/colorette" - }, "files": [ - "index.*", - "colorette.d.ts" + "*.*(c)[tj]s*" ], + "author": "Jorge Bucaran", "keywords": [ - "colorette", "terminal", "styles", "color", "ansi" ], - "author": "Jorge Bucaran", - "license": "MIT", - "bugs": { - "url": "https://github.com/jorgebucaran/colorette/issues" + "scripts": { + "test": "c8 twist tests/*.js", + "build": "node -e \"fs.writeFileSync('index.cjs',fs.readFileSync('index.js','utf8').replace(/export const /g,'exports.'),'utf8')\"", + "deploy": "npm test && git commit --all --message $tag && git tag --sign $tag --message $tag && git push && git push --tags", + "release": "tag=$npm_package_version npm run deploy && npm publish --access public", + "prepare": "npm run build" }, - "homepage": "https://github.com/jorgebucaran/colorette", "devDependencies": { - "c8": "7.2.0", - "testmatrix": "0.1.2" + "c8": "*", + "twist": "*" } } |