https://github.com/litomore/ink-color-pipe
🌈 Create color text with simpler style strings in Ink
https://github.com/litomore/ink-color-pipe
chalk chalk-pipe color ink ink-color-pipe ink-component
Last synced: 3 months ago
JSON representation
🌈 Create color text with simpler style strings in Ink
- Host: GitHub
- URL: https://github.com/litomore/ink-color-pipe
- Owner: LitoMore
- License: mit
- Created: 2019-03-08T15:31:46.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2025-03-24T18:11:12.000Z (about 1 year ago)
- Last Synced: 2025-04-21T06:08:21.108Z (about 1 year ago)
- Topics: chalk, chalk-pipe, color, ink, ink-color-pipe, ink-component
- Language: TypeScript
- Homepage:
- Size: 53.7 KB
- Stars: 23
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# ink-color-pipe
> [chalk-pipe](https://github.com/LitoMore/chalk-pipe) component for [Ink 5](https://github.com/vadimdemedes/ink)
Create color text with simpler style strings in Ink

## Install
```bash
$ npm i ink-color-pipe
```
## Usage
This brings you a convenient way to use some color schemes.

```javascript
import React from "react";
import { render, Text } from "ink";
import Color from "ink-color-pipe";
const link = "blue.underline";
const error = "bgRed.white";
render(
Unicorn
{" Error "}
,
);
```
## Built-in Chalk
All Chalk and `chalk-pipe` exported functions, variables, and declarations are exposed for convenience.
This can be useful if you want to use `chalk` directly.
```js
import { Chalk, chalk, chalkPipe } from "ink-color-pipe";
const customChalk = new Chalk({ level: 0 });
console.log(chalk.blue("Hello"));
console.log(customChalk.green("World"));
console.log(chalkPipe("blue.bgGreen.italic")("Hello World"));
```
## API
### ``
`` is using [``](https://github.com/vadimdemedes/ink#transform) for text rendering.
#### styles
Type: `string`
Use dot `.` to separeate multiple styles.
## Valid Styles
- [Modifiers](https://github.com/chalk/chalk#modifiers)
- [Colors](https://github.com/chalk/chalk#colors)
- [Background colors](https://github.com/chalk/chalk#background-colors)
- [Hex triplet](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet)
- [CSS keywords](https://www.w3.org/wiki/CSS/Properties/color/keywords)
## Related
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
## License
MIT