Chalk with style strings
npm install chalk-string




Chalk with style strings.
Chalk adds styles to terminal strings.chalk-string is a thin wrapper around it which allows specifying those styles
as a string. This enables user-defined or dynamic styling.
``js
import chalkString from 'chalk-string'
chalkString('red')('input') // Same as: chalk.red('input')
chalkString('red bold')('input') // Same as: chalk.red.bold('input')
chalkString('hex-ffffff')('input') // Same as: chalk.hex('ffffff')('input')
chalkString('rgb-10-20-30')('input') // Same as: chalk.rgb(10, 20, 30)('input')
chalkString('invalidStyle')('input') // Invalid styles throw an error
`
`bash`
npm install chalk-string
This package works in Node.js >=18.18.0.
This is an ES module. It must be loaded using
an import or import() statement,
not require(). If TypeScript is used, it must be configured to
output ES modules,
not CommonJS.
styles stylesString\options Options?\addStyles()
_Return value_:
#### colors
_Type_: boolean\undefined
_Default_:
Whether colors should be enabled/disabled, regardless of terminal support.
Colors support is automatically detected, so this is only meant to override that
default behavior.
#### stream
_Type_:
Stream\
_Default_: process.stdout
Stream used to detect colors support. This should be the file or terminal where
the colors are output.
input string\string
_Return value_:
Apply styles to input then return it.
`shStandard styles
bold underline inverse reset
Related projects
colors-option: Let users toggle
colors.
- terminal-theme: 🎨 Use a color
theme for your code's terminal outputSupport
For any question, _don't hesitate_ to submit an issue on GitHub.
Everyone is welcome regardless of personal background. We enforce a
Code of conduct in order to promote a positive and
inclusive environment.
Contributing
This project was made with ❤️. The simplest way to give back is by starring and
sharing it online.
If the documentation is unclear or has a typo, please click on the page's
Edit`If you would like to help us fix a bug or add a new feature, please check our
guidelines. Pull requests are welcome!