ink-color-pipe
v5.0.0
Published
Create color text with simpler style strings in Ink
Downloads
107
Maintainers
Readme
ink-color-pipe
chalk-pipe component for Ink 5
Create color text with simpler style strings in Ink
Install
$ npm i ink-color-pipeUsage
This brings you a convenient way to use some color schemes.
import React from "react";
import { render, Text } from "ink";
import Color from "ink-color-pipe";
const link = "blue.underline";
const error = "bgRed.white";
render(
<Text>
<Color styles={link}>Unicorn</Color>
<Color styles={error}>{" Error "}</Color>
</Text>,
);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.
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
<Color>
<Color> is using <Transform> for text rendering.
styles
Type: string
Use dot . to separeate multiple styles.
Valid Styles
Related
- chalk-pipe - Create chalk style schemes with simpler style strings
License
MIT
