npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gradient-boxen

v1.1.0

Published

A combo of gradient-string + boxen

Downloads

13

Readme

gradient-boxen

A combo of gradient-string + boxen

image

gradient-boxen is a library that allows you to create fully customizable gradient boxes in the terminal. Because what's better than a gradient-y string and a cool terminal box? A gradient box!

It effectively combines the popular NPM packages boxen and gradient-string into one unified package.

🛠️ Install

Using npm

npm i gradient-boxen

Note This package is ESM only. Please check out this guide on how to convert your project to ESM


🔗 Usage

Note This package will properly display gradient boxes only in terminals with TrueColor support, ie, 16 million colors, in order to properly display the gradients. This should work alright in most terminal and shells

  • Using an array of gradient colors
import gradientBox from 'gradient-boxen';

console.log(
  gradientBox(
    'I love gradients!',
    {
      borderStyle: 'round',
      padding: 1,
      margin: 1,
    },
    ['#11998e', '#38ef7d']
  )
);

Output:

image

  • Using a predefined preset
import gradientBox from 'gradient-boxen';

console.log(
  gradientBox(
    'I love gradients!',
    {
      borderStyle: 'round',
      padding: 1,
      margin: 1,
    },
    'fruit'
  )
);

Output:

image

Presets

These presets have been ported from gradient-string


🔮 API

gradientBox(boxText, boxOptions, gradientOptions)

boxText

Type: string

Text inside the box. Can be multiline too.

Warning All pre-existing ANSI colors are stripped from the text, so that the gradient can be properly displayed

boxOptions

Type: object

The configuration options for the box as per the boxen package

Options include:

{
  borderColor?: string
  borderStyle?: string
  dimBorder?: boolean
  padding?: number
  margin?: number
  float?: 'left' | 'right' | 'center'
  backgroundColor?: 'string'
  textAlignment?: 'left' | 'right' | 'center';
  title?: string
  titleAlignment?: 'left' | 'right' | 'center'
  width?: number
  height?: number
  fullscreen?: boolean
}

gradientOptions

Type: string or string[]

The gradient preset (or a set of gradients) to be used for the box. Can be a string or an array of valid color codes.

A list of presets can be found here


❤️ Support

You can support further development of this project by giving it a 🌟 and help me make even better stuff in the future by buying me a ☕

Also, if you liked this repo, consider checking out my other projects, that would be real cool!


💫 Attributions and special thanks