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

calime

v1.0.1

Published

A Node.js class for stylish console text with colors, gradients, and multiple text styles. Easy chaining for seamless styling.

Downloads

4

Readme

calime

Introduction

Calime is a versatile and lightweight class for styling and manipulating text in Node.js applications, particularly useful for console output. It offers a range of text styling options, such as color, background color, and text formatting styles like bold, underline, and italic.

::: tip While Calime provides various styling options, it aims to keep a balance between functionality and simplicity. For complex text and background color combinations, consider using libraries like chalk for more complete solutions. Calime may choose to skip adding such complex features to maintain code simplicity. ::::

Features

  • Multiple Text Styles: Apply various text styles including bold, underline, italic, and more.
  • Color Support: Easily set text and background colors.
  • Text Gradients: Create gradient effects on text using multiple colors.
  • Chainable Methods: Methods can be chained for concise code.

Installation

calime is available as an independent package on npm and can be installed in your Node.js project. Since it is exclusively an ESModule, ensure your environment supports ESModule syntax. To install calime, run the following command in your project directory:

npm install calime

Usage

To use Calime, first import or include it in your Node.js project. Then, create a new instance of Calime and start styling your text.

import Calime from 'calime'; // Adjust the import path as per your project structure

const myText = new Calime("Hello, World!");
myText.apply('bold').color([255, 0, 0]); // Applying bold style and red color
console.log(myText.render()); // Outputs styled text

API Reference

Constructor

  • Calime(text: string) - Initialize with the specified text.

Methods

  • apply(style: Style): Calime - Apply a text style.
  • setText(text: string): Calime - Set or update the text.
  • color(color: Color): Calime - Set the text color.
  • gradient(...colors: Color[]): Calime - Apply a gradient effect to the text.
  • background(color: Color): Calime - Set the background color of the text.
  • render(): string - Returns the styled text.

Static Methods

  • static gradientColor(ratio: number, ...colors: Color[]): Color - Compute gradient color.

License

Calime is open-sourced MIT license and can be used freely in your projects.