yeet
This commit is contained in:
7
node_modules/colorette/LICENSE.md
generated
vendored
Normal file
7
node_modules/colorette/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright © Jorge Bucaran <<https://jorgebucaran.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.
|
102
node_modules/colorette/README.md
generated
vendored
Normal file
102
node_modules/colorette/README.md
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
# Colorette
|
||||
|
||||
> Easily set the color and style of text in the terminal.
|
||||
|
||||
- No wonky prototype method-chain API.
|
||||
- Automatic color support detection.
|
||||
- Up to [2x faster](#benchmarks) than alternatives.
|
||||
- [`NO_COLOR`](https://no-color.org) friendly. 👌
|
||||
|
||||
Here's the first example to get you started.
|
||||
|
||||
```js
|
||||
import { blue, bold, underline } from "colorette"
|
||||
|
||||
console.log(
|
||||
blue("I'm blue"),
|
||||
bold(blue("da ba dee")),
|
||||
underline(bold(blue("da ba daa")))
|
||||
)
|
||||
```
|
||||
|
||||
Here's an example using [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals).
|
||||
|
||||
```js
|
||||
console.log(`
|
||||
There's a ${underline(blue("house"))},
|
||||
With a ${bold(blue("window"))},
|
||||
And a ${blue("corvette")}
|
||||
And everything is blue
|
||||
`)
|
||||
```
|
||||
|
||||
Of course, you can nest styles without breaking existing color sequences.
|
||||
|
||||
```js
|
||||
console.log(bold(`I'm ${blue(`da ba ${underline("dee")} da ba`)} daa`))
|
||||
```
|
||||
|
||||
Feeling adventurous? Try the [pipeline operator](https://github.com/tc39/proposal-pipeline-operator).
|
||||
|
||||
```js
|
||||
console.log("Da ba dee da ba daa" |> blue |> bold)
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```console
|
||||
npm install colorette
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `<style>(string)`
|
||||
|
||||
```js
|
||||
import { blue } from "colorette"
|
||||
|
||||
blue("I'm blue") //=> \x1b[34mI'm blue\x1b[39m
|
||||
```
|
||||
|
||||
See [supported styles]().
|
||||
|
||||
### `options.enabled`
|
||||
|
||||
Colorette automatically detects if your terminal can display color, but you can toggle color as needed.
|
||||
|
||||
```js
|
||||
import { options } from "colorette"
|
||||
|
||||
options.enabled = false
|
||||
```
|
||||
|
||||
You can also force the use of color globally by setting `FORCE_COLOR=` or `NO_COLOR=` from the CLI.
|
||||
|
||||
```console
|
||||
$ FORCE_COLOR= node example.js >log
|
||||
$ NO_COLOR= node example.js
|
||||
```
|
||||
|
||||
## Supported styles
|
||||
|
||||
| Colors | Background Colors | Bright Colors | Bright Background Colors | Modifiers |
|
||||
| ------- | ----------------- | ------------- | ------------------------ | ----------------- |
|
||||
| black | bgBlack | blackBright | bgBlackBright | dim |
|
||||
| red | bgRed | redBright | bgRedBright | **bold** |
|
||||
| green | bgGreen | greenBright | bgGreenBright | hidden |
|
||||
| yellow | bgYellow | yellowBright | bgYellowBright | _italic_ |
|
||||
| blue | bgBlue | blueBright | bgBlueBright | <u>underline</u> |
|
||||
| magenta | bgMagenta | magentaBright | bgMagentaBright | ~~strikethrough~~ |
|
||||
| cyan | bgCyan | cyanBright | bgCyanBright | reset |
|
||||
| white | bgWhite | whiteBright | bgWhiteBright | |
|
||||
| gray | | | | |
|
||||
|
||||
## Benchmarks
|
||||
|
||||
```console
|
||||
npm --prefix bench start
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE.md)
|
73
node_modules/colorette/index.cjs
generated
vendored
Normal file
73
node_modules/colorette/index.cjs
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
let enabled =
|
||||
!("NO_COLOR" in process.env) &&
|
||||
("FORCE_COLOR" in process.env ||
|
||||
process.platform === "win32" ||
|
||||
(process.stdout != null &&
|
||||
process.stdout.isTTY &&
|
||||
process.env.TERM &&
|
||||
process.env.TERM !== "dumb"))
|
||||
|
||||
const raw = (open, close, searchRegex, replaceValue) => (s) =>
|
||||
enabled
|
||||
? open +
|
||||
(~(s += "").indexOf(close, 4) // skip opening \x1b[
|
||||
? s.replace(searchRegex, replaceValue)
|
||||
: s) +
|
||||
close
|
||||
: s
|
||||
|
||||
const init = (open, close) => {
|
||||
return raw(
|
||||
`\x1b[${open}m`,
|
||||
`\x1b[${close}m`,
|
||||
new RegExp(`\\x1b\\[${close}m`, "g"),
|
||||
`\x1b[${open}m`
|
||||
)
|
||||
}
|
||||
|
||||
exports.options = Object.defineProperty({}, "enabled", {
|
||||
get: () => enabled,
|
||||
set: (value) => (enabled = value),
|
||||
})
|
||||
|
||||
exports.reset = init(0, 0)
|
||||
exports.bold = raw("\x1b[1m", "\x1b[22m", /\x1b\[22m/g, "\x1b[22m\x1b[1m")
|
||||
exports.dim = raw("\x1b[2m", "\x1b[22m", /\x1b\[22m/g, "\x1b[22m\x1b[2m")
|
||||
exports.italic = init(3, 23)
|
||||
exports.underline = init(4, 24)
|
||||
exports.inverse = init(7, 27)
|
||||
exports.hidden = init(8, 28)
|
||||
exports.strikethrough = init(9, 29)
|
||||
exports.black = init(30, 39)
|
||||
exports.red = init(31, 39)
|
||||
exports.green = init(32, 39)
|
||||
exports.yellow = init(33, 39)
|
||||
exports.blue = init(34, 39)
|
||||
exports.magenta = init(35, 39)
|
||||
exports.cyan = init(36, 39)
|
||||
exports.white = init(37, 39)
|
||||
exports.gray = init(90, 39)
|
||||
exports.bgBlack = init(40, 49)
|
||||
exports.bgRed = init(41, 49)
|
||||
exports.bgGreen = init(42, 49)
|
||||
exports.bgYellow = init(43, 49)
|
||||
exports.bgBlue = init(44, 49)
|
||||
exports.bgMagenta = init(45, 49)
|
||||
exports.bgCyan = init(46, 49)
|
||||
exports.bgWhite = init(47, 49)
|
||||
exports.blackBright = init(90, 39)
|
||||
exports.redBright = init(91, 39)
|
||||
exports.greenBright = init(92, 39)
|
||||
exports.yellowBright = init(93, 39)
|
||||
exports.blueBright = init(94, 39)
|
||||
exports.magentaBright = init(95, 39)
|
||||
exports.cyanBright = init(96, 39)
|
||||
exports.whiteBright = init(97, 39)
|
||||
exports.bgBlackBright = init(100, 49)
|
||||
exports.bgRedBright = init(101, 49)
|
||||
exports.bgGreenBright = init(102, 49)
|
||||
exports.bgYellowBright = init(103, 49)
|
||||
exports.bgBlueBright = init(104, 49)
|
||||
exports.bgMagentaBright = init(105, 49)
|
||||
exports.bgCyanBright = init(106, 49)
|
||||
exports.bgWhiteBright = init(107, 49)
|
49
node_modules/colorette/index.d.ts
generated
vendored
Normal file
49
node_modules/colorette/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
interface Style {
|
||||
(string: string): string
|
||||
}
|
||||
|
||||
export const options: {
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export const reset: Style
|
||||
export const bold: Style
|
||||
export const dim: Style
|
||||
export const italic: Style
|
||||
export const underline: Style
|
||||
export const inverse: Style
|
||||
export const hidden: Style
|
||||
export const strikethrough: Style
|
||||
export const black: Style
|
||||
export const red: Style
|
||||
export const green: Style
|
||||
export const yellow: Style
|
||||
export const blue: Style
|
||||
export const magenta: Style
|
||||
export const cyan: Style
|
||||
export const white: Style
|
||||
export const gray: Style
|
||||
export const bgBlack: Style
|
||||
export const bgRed: Style
|
||||
export const bgGreen: Style
|
||||
export const bgYellow: Style
|
||||
export const bgBlue: Style
|
||||
export const bgMagenta: Style
|
||||
export const bgCyan: Style
|
||||
export const bgWhite: Style
|
||||
export const blackBright: Style
|
||||
export const redBright: Style
|
||||
export const greenBright: Style
|
||||
export const yellowBright: Style
|
||||
export const blueBright: Style
|
||||
export const magentaBright: Style
|
||||
export const cyanBright: Style
|
||||
export const whiteBright: Style
|
||||
export const bgBlackBright: Style
|
||||
export const bgRedBright: Style
|
||||
export const bgGreenBright: Style
|
||||
export const bgYellowBright: Style
|
||||
export const bgBlueBright: Style
|
||||
export const bgMagentaBright: Style
|
||||
export const bgCyanBright: Style
|
||||
export const bgWhiteBright: Style
|
73
node_modules/colorette/index.js
generated
vendored
Normal file
73
node_modules/colorette/index.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
let enabled =
|
||||
!("NO_COLOR" in process.env) &&
|
||||
("FORCE_COLOR" in process.env ||
|
||||
process.platform === "win32" ||
|
||||
(process.stdout != null &&
|
||||
process.stdout.isTTY &&
|
||||
process.env.TERM &&
|
||||
process.env.TERM !== "dumb"))
|
||||
|
||||
const raw = (open, close, searchRegex, replaceValue) => (s) =>
|
||||
enabled
|
||||
? open +
|
||||
(~(s += "").indexOf(close, 4) // skip opening \x1b[
|
||||
? s.replace(searchRegex, replaceValue)
|
||||
: s) +
|
||||
close
|
||||
: s
|
||||
|
||||
const init = (open, close) => {
|
||||
return raw(
|
||||
`\x1b[${open}m`,
|
||||
`\x1b[${close}m`,
|
||||
new RegExp(`\\x1b\\[${close}m`, "g"),
|
||||
`\x1b[${open}m`
|
||||
)
|
||||
}
|
||||
|
||||
export const options = Object.defineProperty({}, "enabled", {
|
||||
get: () => enabled,
|
||||
set: (value) => (enabled = value),
|
||||
})
|
||||
|
||||
export const reset = init(0, 0)
|
||||
export const bold = raw("\x1b[1m", "\x1b[22m", /\x1b\[22m/g, "\x1b[22m\x1b[1m")
|
||||
export const dim = raw("\x1b[2m", "\x1b[22m", /\x1b\[22m/g, "\x1b[22m\x1b[2m")
|
||||
export const italic = init(3, 23)
|
||||
export const underline = init(4, 24)
|
||||
export const inverse = init(7, 27)
|
||||
export const hidden = init(8, 28)
|
||||
export const strikethrough = init(9, 29)
|
||||
export const black = init(30, 39)
|
||||
export const red = init(31, 39)
|
||||
export const green = init(32, 39)
|
||||
export const yellow = init(33, 39)
|
||||
export const blue = init(34, 39)
|
||||
export const magenta = init(35, 39)
|
||||
export const cyan = init(36, 39)
|
||||
export const white = init(37, 39)
|
||||
export const gray = init(90, 39)
|
||||
export const bgBlack = init(40, 49)
|
||||
export const bgRed = init(41, 49)
|
||||
export const bgGreen = init(42, 49)
|
||||
export const bgYellow = init(43, 49)
|
||||
export const bgBlue = init(44, 49)
|
||||
export const bgMagenta = init(45, 49)
|
||||
export const bgCyan = init(46, 49)
|
||||
export const bgWhite = init(47, 49)
|
||||
export const blackBright = init(90, 39)
|
||||
export const redBright = init(91, 39)
|
||||
export const greenBright = init(92, 39)
|
||||
export const yellowBright = init(93, 39)
|
||||
export const blueBright = init(94, 39)
|
||||
export const magentaBright = init(95, 39)
|
||||
export const cyanBright = init(96, 39)
|
||||
export const whiteBright = init(97, 39)
|
||||
export const bgBlackBright = init(100, 49)
|
||||
export const bgRedBright = init(101, 49)
|
||||
export const bgGreenBright = init(102, 49)
|
||||
export const bgYellowBright = init(103, 49)
|
||||
export const bgBlueBright = init(104, 49)
|
||||
export const bgMagentaBright = init(105, 49)
|
||||
export const bgCyanBright = init(106, 49)
|
||||
export const bgWhiteBright = init(107, 49)
|
39
node_modules/colorette/package.json
generated
vendored
Normal file
39
node_modules/colorette/package.json
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "colorette",
|
||||
"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",
|
||||
".": {
|
||||
"require": "./index.cjs",
|
||||
"import": "./index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"*.*(c)[tj]s*"
|
||||
],
|
||||
"author": "Jorge Bucaran",
|
||||
"keywords": [
|
||||
"terminal",
|
||||
"styles",
|
||||
"color",
|
||||
"ansi"
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"c8": "*",
|
||||
"twist": "*"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user