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

acquerello

v2.0.8

Published

Template based terminal coloring made really easy.

Downloads

525,964

Readme

acquerello

Version Dependencies Build Coverage

Template based terminal coloring made really easy.

http://sw.cowtech.it/acquerello

Usage

Acquerello allows to add coloring to terminal in a really easy way.

Colorize templates

To colorize a template using template syntax, simply use the colorize function.

import { colorize } from 'acquerello'

console.log(colorize('{{red}}This is in red, {{green underline}}this in green underlined{{-}}, this in red again.'))

The template recognizes styles between double curly braces and the token {{-}} as universal closing tag (which also restores the previous style).

Acquerello supports all colors codes recognized by ansi-style (and therefore by chalk).

The closing tag at the end of the string can be omitted, since acquerello will append the global reset style (\x1b[0m) if any style was set.

If you want to discard the styles to be restored, use the {{reset}} token.

Setting custom styles

If you want to define custom styles, use the addCustomStyle function.

import { colorize, addCustomStyle } from 'acquerello'

addCustomStyle('important')
console.log(colorize('{{important}}This is in red, underlined.{{-}}'))

256 and 16 millions colors support

acquerello supports 256 ANSI codes and 16m RGB colors. Just give it a try:

import { colorize } from 'acquerello'

console.log(colorize('{{ansi:100}}color me{{-}}'))
console.log(colorize('{{bgANSI:3,4,5}}color me{{-}}'))

console.log(colorize('{{rgb:255,0,0}}color me{{-}}'))
console.log(colorize('{{bgRGB:0,255,0}}color me{{-}}'))

console.log(colorize('{{hex:#FF0000}}color me{{-}}'))
console.log(colorize('{{bgHEX:00FF00}}color me{{-}}'))

ANSI, RGB, and HEX can be used in style definitions and templates as well.

Colorize strings

To colorize strings, simply use the applyStyle, passing a list of styles you want to apply.

import { applyStyle } from 'acquerello'

const inRed = applyStyle('Colorized', 'red')
const inRedWithBlueBackground = applyStyle('Colorized', 'red bgBlue')

ESM Only

This package only supports to be directly imported in a ESM context.

For informations on how to use it in a CommonJS context, please check this page.

Contributing to acquerello

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

Copyright

Copyright (C) 2019 and above Shogun ([email protected]).

Licensed under the ISC license, which can be found at https://choosealicense.com/licenses/isc.