1
0
mirror of https://github.com/garraflavatra/trmclr.git synced 2025-01-18 03:07:57 +00:00

Add stripColor to readme

This commit is contained in:
Romein van Buren 2024-08-09 15:01:08 +02:00
parent 8953fdb34e
commit 94bd33c40d
No known key found for this signature in database

View File

@ -20,9 +20,24 @@ import { cyan, bgMagenta } from 'trmclr';
console.log(cyan(bgMagenta('Some text')));
```
## Enable or disable color
### Enable or disable color
By using `setColorEnabled(true)` or `setColorEnabled(false)` you can respectively enable and disable color output. Use `getColorEnabled()` to retrieve the current state.
```js
import { getColorEnabled, setColorEnabled } from 'trmclr';
setColorEnabled(true);
setColorEnabled(false);
getColorEnabled(); // → false
```
### Remove colors and decorations
```js
import { cyan, stripColor } from 'trmclr';
stripColor(cyan('Hi')); // → uncolored "Hi"
```
## License