{"_id":"ansi-styles@7.0.0","bugs":{"url":"https://github.com/chalk/ansi-styles/issues"},"dist":{"shasum":"859089a725560e235a41fecde8999196df6c78c0","tarball":"http://registry-npm.ywwl.com/ansi-styles/download/ansi-styles-7.0.0.tgz","fileCount":5,"integrity":"sha512-kKvt3m4uwzqL0wlkPd09CmljPJGOZZ4D0fP65sqFSvPkMRKhNi+74MgIJ5QxE6SxqB4t4KyUFGg8+n5zjo6hew==","signatures":[{"sig":"MEUCIQCasXowPAqN+liuuv7siVzyduwWlhsZG4Gpt7cL+eKP9wIgLHZeijrPGeHaM9jyvIyW8csNSkyLQhYVlcbm5LN5EpQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHrjJ1wqcQ/rB/tdvYTZiXxXuCl+vxh/8nXcIc7gUf37AiAFyfOvT8FcDzGmesdc1qHgc36SnmkFGojqVWEmLT2ZlQ=="}],"unpackedSize":22120,"size":6614,"noattachment":false,"key":"/ansi-styles/-/ansi-styles-7.0.0.tgz"},"name":"ansi-styles","type":"module","types":"./index.d.ts","author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"engines":{"node":">=22"},"exports":"./index.js","funding":"https://github.com/chalk/ansi-styles?sponsor=1","gitHead":"c1c3dd4e017a2938807aaff0d361f46d086aeab7","license":"MIT","scripts":{"test":"xo && ava && tsd","screenshot":"svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"},"version":"7.0.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"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"],"repository":{"url":"git+https://github.com/chalk/ansi-styles.git","type":"git"},"_npmVersion":"12.0.1","description":"ANSI escape codes for styling strings in the terminal","directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_nodeVersion":"22.23.1","_hasShrinkwrap":false,"devDependencies":{"xo":"^4.0.0","ava":"^8.0.1","tsd":"^0.33.0","svg-term-cli":"^2.1.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ansi-styles_7.0.0_1785077856753_0.616452296505001"},"readme":"# ansi-styles\n\n> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal\n\nYou probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.\n\n![](screenshot.png)\n\n## Install\n\n```sh\nnpm install ansi-styles\n```\n\n## Usage\n\n```js\nimport styles from 'ansi-styles';\n\nconsole.log(`${styles.green.open}Hello world!${styles.green.close}`);\n\n\n// Color conversion between 256/truecolor\n// NOTE: When converting from truecolor to 256 colors, the original color\n//       may be degraded to fit the new color palette. This means terminals\n//       that do not support 16 million colors will best-match the\n//       original color.\nconsole.log(`${styles.color.ansi(styles.rgbToAnsi(199, 20, 250))}Hello World${styles.color.close}`)\nconsole.log(`${styles.color.ansi256(styles.rgbToAnsi256(199, 20, 250))}Hello World${styles.color.close}`)\nconsole.log(`${styles.color.ansi16m(...styles.hexToRgb('#abcdef'))}Hello World${styles.color.close}`)\n```\n\n## API\n\n### `open` and `close`\n\nEach style has an `open` and `close` property.\n\n### `modifierNames`, `foregroundColorNames`, `backgroundColorNames`, `underlineColorNames`, and `colorNames`\n\nAll supported style strings are exposed as an array of strings for convenience. `colorNames` is the combination of `foregroundColorNames` and `backgroundColorNames`. Underline color names are kept separate in `underlineColorNames`.\n\nThis can be useful if you need to validate input:\n\n```js\nimport {modifierNames, foregroundColorNames} from 'ansi-styles';\n\nconsole.log(modifierNames.includes('bold'));\n//=> true\n\nconsole.log(foregroundColorNames.includes('pink'));\n//=> false\n```\n\n## Styles\n\n### Modifiers\n\n- `reset`\n- `bold`\n- `dim`\n- `italic` *(Not widely supported)*\n- `underline` - Put a horizontal line below the text. *(Not widely supported)*\n- `underlineDouble` - Put a double horizontal line below the text. *(Not widely supported)*\n- `underlineCurly` - Put a curly horizontal line below the text. *(Not widely supported)*\n- `underlineDotted` - Put a dotted horizontal line below the text. *(Not widely supported)*\n- `underlineDashed` - Put a dashed horizontal line below the text. *(Not widely supported)*\n- `overline` *Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash.*\n- `inverse`\n- `hidden`\n- `strikethrough` *(Not widely supported)*\n\n### Colors\n\n- `black`\n- `red`\n- `green`\n- `yellow`\n- `blue`\n- `magenta`\n- `cyan`\n- `white`\n- `blackBright` (alias: `gray`, `grey`)\n- `redBright`\n- `greenBright`\n- `yellowBright`\n- `blueBright`\n- `magentaBright`\n- `cyanBright`\n- `whiteBright`\n\n### Background colors\n\n- `bgBlack`\n- `bgRed`\n- `bgGreen`\n- `bgYellow`\n- `bgBlue`\n- `bgMagenta`\n- `bgCyan`\n- `bgWhite`\n- `bgBlackBright` (alias: `bgGray`, `bgGrey`)\n- `bgRedBright`\n- `bgGreenBright`\n- `bgYellowBright`\n- `bgBlueBright`\n- `bgMagentaBright`\n- `bgCyanBright`\n- `bgWhiteBright`\n\n### Underline colors\n\nThe underline color is set independently of the text color, so the color is only visible when an underline style is also applied. *(Not widely supported)*\n\nUnlike text and background colors, underline colors have no basic 16-color form. Named underline colors and `underlineColor.ansi()` use the first 16 entries of the 256-color palette. `underlineColor.ansi256()` emits a 256-color escape, and `underlineColor.ansi16m()` emits a truecolor escape.\n\n- `underlineBlack`\n- `underlineRed`\n- `underlineGreen`\n- `underlineYellow`\n- `underlineBlue`\n- `underlineMagenta`\n- `underlineCyan`\n- `underlineWhite`\n- `underlineBlackBright` (alias: `underlineGray`, `underlineGrey`)\n- `underlineRedBright`\n- `underlineGreenBright`\n- `underlineYellowBright`\n- `underlineBlueBright`\n- `underlineMagentaBright`\n- `underlineCyanBright`\n- `underlineWhiteBright`\n\n## Advanced usage\n\nBy 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.\n\n- `styles.modifier`\n- `styles.color`\n- `styles.bgColor`\n- `styles.underlineColor`\n\n###### Style groups example\n\n```js\nimport styles from 'ansi-styles';\n\nconsole.log(styles.color.green.open);\n```\n\nThe leading SGR parameters of the styles are available under `styles.codes`, which returns a `Map` with the open codes as keys and close codes as values. Parameterized styles such as `4:2` and `58;5;0` are keyed by their leading parameter, `4` and `58` respectively.\n\n###### Style codes example\n\n```js\nimport styles from 'ansi-styles';\n\nconsole.log(styles.codes.get(36));\n//=> 39\n```\n\n## 16 / 256 / 16 million (TrueColor) support\n\n`ansi-styles` allows converting between various color formats and ANSI escapes, with support for 16, 256 and [16 million colors](https://github.com/termstandard/colors).\n\nThe following color spaces are supported:\n\n- `rgb`\n- `hex`\n- `ansi256`\n- `ansi`\n\nTo use these, call the associated conversion function with the intended output, for example:\n\n```js\nimport styles from 'ansi-styles';\n\nstyles.color.ansi(styles.rgbToAnsi(100, 200, 15)); // RGB to 16 color ansi foreground code\nstyles.bgColor.ansi(styles.hexToAnsi('#C0FFEE')); // HEX to 16 color ansi foreground code\n\nstyles.color.ansi256(styles.rgbToAnsi256(100, 200, 15)); // RGB to 256 color ansi foreground code\nstyles.bgColor.ansi256(styles.hexToAnsi256('#C0FFEE')); // HEX to 256 color ansi foreground code\nstyles.underlineColor.ansi(styles.rgbToAnsi(100, 200, 15)); // RGB to underline code using the first 16 palette entries\n\nstyles.color.ansi16m(100, 200, 15); // RGB to 16 million color foreground code\nstyles.bgColor.ansi16m(...styles.hexToRgb('#C0FFEE')); // Hex (RGB) to 16 million color foreground code\n\nstyles.underlineColor.ansi256(styles.hexToAnsi256('#C0FFEE')); // HEX to 256 color underline code\nstyles.underlineColor.ansi16m(...styles.hexToRgb('#C0FFEE')); // Hex (RGB) to 16 million color underline code\n```\n\n## Related\n\n- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [Josh Junon](https://github.com/qix-)\n","publish_time":1785077856835,"_cnpm_publish_time":1785077856835,"dist-tags":{"latest":"7.0.0"}}