{"id":"jsdotlua/chalk","name":"chalk","scope":"jsdotlua","platform":"roblox","description":"Mirrored from the Wally registry.","version":"0.2.1","latest":"0.2.1","versions":["0.2.1"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{},"integrity":"af76e59740a7748f079c5f72ab05016ff1c092a7fca345a2acb71fc65b26ab66","likes":0,"downloads":0,"install":"forest install jsdotlua/chalk","url":"https://forest.dev/p/roblox/jsdotlua/chalk","files":"https://api.forest.dev/ai/package/roblox/jsdotlua/chalk/files","readme":"# Chalk-Lua\n\nA Lua port of the open source JS terminal string styling library [Chalk](https://github.com/chalk/chalk).\n\n<img src=\"https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg\" width=\"900\">\n\n---\n\n## Installation\n\nAdd this package to your `[dependencies]` in your `rotriever.toml`.\n```\nChalk = \"github.com/roblox/chalk-lua@0.2.0\"\n```\n\nRun `rotrieve install` to install the package.\n\nRequire it at the top of your file.\n```lua\nlocal chalk = require(Packages.Chalk)\n```\n\n---\n\n## API\n\n`chalk.style(string)` to style a `string` (or `tostring`-able object) with any of the following modifiers, colors or color models.\n\n### Modifiers\n\n* `reset` - Resets the current color chain.\n* `bold` - Make text bold.\n* `dim` - Emitting only a small amount of light.\n* `italic` - Make text italic. *(Not widely supported)*\n* `underline` - Make text underline. *(Not widely supported)*\n* `inverse`- Inverse background and foreground colors.\n* `hidden` - Prints the text, but makes it invisible.\n* `strikethrough` - Puts a horizontal line through the center of the text. *(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\nStyles can be nested to apply multiple styles at the same time.\n```lua\nchalk.red(chalk.bold('red and bold'))\n```\nLater styles take precedence in case of a conflict (multiple nested styles of the same type). For example, `chalk.red(chalk.blue(chalk.green('green')))` will output green text.\n\nStyles can be concatenated with `..` to be composed and stored.\n```lua\nlocal errorMessage = chalk.red..chalk.bold\nerrorMessage('red and bold')\n```\n\nThe following color models can also be used:\n```lua\n-- accepts ANSI16 color codes\nchalk.ansi(31)('red') -- valid values: 30-37, 90-97\nchalk.bgAnsi(41)('bgRed') -- valid values: 40-47, 100-107\n\n-- accepts ANSI256 color codes \nchalk.ansi256(196)('#ff0000') -- valid values: 0-255\nchalk.bgAnsi256(196)('#ff0000') -- valid values: 0-255\n\n-- downsamples to a valid ANSI256 color\nchalk.rgb(255, 0, 0)('#ff0000')\nchalk.bgRgb(255, 0, 0)('#ff0000')\n\nchalk.hex('#ff0000')('red')\nchalk.bgHex('#ff0000')('red')\n```\n\n`chalk.level` specifies the level of color support. This can be set by setting `chalk.level` to a different value, for example, `chalk.level = 0` to disable color support. Note that this will affect all uses of `chalk` throughout the entire module. The default value is 2. The flag `NOCOLOR` can be set with `--lua.globals=NOCOLOR=true` to set the default value to 0.\n| Level | Description |\n| :---: | :--- |\n| `0` | All colors disabled |\n| `2` | 256 color support |\n\n---\n\n## Unsupported features\n\n* `chalk.level` - only suppors either level 2 or level 0\n    * No automatic detection of terminal color support\n    * Level 3 isn't supported so `rgb` and `hex` will downsample to the closest ANSI256 color\n    * Level 1 isn't supported so color models with ANSI256 support (`ansi256`, `rgb`, `hex`) will never downsample to ANSI16\n* The following color models:\n    * `chalk.keyword`\n    * `chalk.hsl`\n    * `chalk.hsv`\n    * `chalk.hwb`\n* Can't method chain styles together like JS chalk, prefer to nest them instead. If they need to be composed together to be stored, use the concatenation (`..`) operator.\n```lua\n-- chalk.red.bold('foo')\nchalk.red(chalk.bold('foo'))\n\n-- const errorMessage = chalk.red.bold\nlocal errorMessage = chalk.red..chalk.bold\n```\n* Can't nest styles of the same \"type\" (foreground or background color), prefer to split them up. Styles of different types can be nested, however, still prefer to split them up for consistency.\n```lua\n-- chalk.blue('blue' + chalk.red('red') + 'blue')\nchalk.blue('blue' .. chalk.red('red') .. 'not blue')\nchalk.blue('blue') .. chalk.red('red') .. chalk.blue('blue')\n```\n","readmeTruncated":false}