
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
ink-gradient
Advanced tools
The ink-gradient package is used to apply gradient colors to text in Ink applications, which are React-based CLI applications. It allows developers to enhance the visual appeal of their command-line interfaces by adding colorful gradients to text output.
Basic Gradient Application
This feature allows you to apply a basic gradient to text. In this example, the 'rainbow' gradient is applied to the text 'Hello, world!' using the Ink framework.
const Gradient = require('ink-gradient');
const { h, render } = require('ink');
const App = () => (
<Gradient name="rainbow">
Hello, world!
</Gradient>
);
render(<App />);
Custom Gradient Colors
This feature allows you to define custom colors for the gradient. In this example, a gradient is created using red, green, and blue colors for the text 'Custom Gradient!'.
const Gradient = require('ink-gradient');
const { h, render } = require('ink');
const App = () => (
<Gradient colors={['#FF0000', '#00FF00', '#0000FF']}>
Custom Gradient!
</Gradient>
);
render(<App />);
Chalk is a popular package for styling terminal strings in Node.js. While it doesn't specifically focus on gradients, it provides a wide range of text styling options, including colors, background colors, and text decorations. Chalk is more versatile for general text styling, whereas ink-gradient is specialized for gradient effects in Ink applications.
Gradient-string is a package that allows you to apply gradient colors to strings in the terminal. It is similar to ink-gradient in that it focuses on gradient effects, but it is not specifically designed for use with Ink applications. Gradient-string can be used in any Node.js application to create colorful text outputs.
Gradient color component for Ink
npm install ink-gradient
import React from 'react';
import {render} from 'ink';
import Gradient from 'ink-gradient';
import BigText from 'ink-big-text';
render(
<Gradient name="rainbow">
<BigText text="unicorns"/>
</Gradient>
);
<Gradient>
It accepts a string or Ink component as children
. For example, <Box/>
.
Type: string
The name of a built-in gradient.
Mutually exclusive with colors
.
Type: string[] | object[]
Colors to use to make the gradient.
Mutually exclusive with name
.
FAQs
Gradient color component for Ink
The npm package ink-gradient receives a total of 438,781 weekly downloads. As such, ink-gradient popularity was classified as popular.
We found that ink-gradient demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.