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

fullcolor

v0.1.1

Published

Full 24-bit terminal colors for Node.js (no frills, no dependencies)

Downloads

7

Readme

Fullcolor: A minimalist 24-bit color module for Node.js

Use full 24-bit colors in Node.js! This module makes it simple to use and has zero dependencies.

image

Installation

npm install fullcolor
# Alternatively:
# yarn install fullcolor

In your node.js file, include the module

const fullcolor = require('fullcolor');

API

The fullcolor function simply adds escape sequences and returns the text as a string. The first argument is always the text you want to color. This also only changes the text color and not the background.

Install

fullcolor(text, colorString)

As of right now, only hex values are accepted for colorString.

const fullcolor = require('fullcolor');

console.log(fullcolor('Let there be colors!', '#66ccff'));
console.log(fullcolor('Let there be colors!', '#6cf'));

fullcolor(text, r, g, b)

The values r,g,b must be integers from 0 to 255.

const fullcolor = require('fullcolor');

console.log(fullcolor('Let there be colors!', 102, 204, 255));

So simple, you might not even need to use it!

If you simply want to print a few different colors to the terminal, you might not even need this module! Just copy and paste this snippet:

// Settings in this example:
// text = 'TEXT GOES HERE'
// r = 102
// g = 204
// b = 255
console.log('\x1b[38;2;102;204;255mTEXT GOES HERE\x1b[0m')

// If you use fullcolor, it becomes:
console.log(fullcolor('TEXT GOES HERE', 102, 204, 255))

// If you don't use fullcolor, I'm still happy that you read this.
// I hope this was helpful and hope that I helped you avoid adding a dependency.
// Also, a GitHub star is appreciated ;)

But if you do want a lightweight abstraction, then this module might be for you!

Simple and clean

No side effects. No state. No singletons. Does not monkeypatch or mutate anything.

No dependencies. Ever.

No dependencies. Never will have dependencies. Except of course JavaScript. This might even work in the browser as-is (this doesn't even use Node.js standard libraries), but I'm not sure how useful that'll be.

Why? This is a simple tool that adds a few characters to a string. That's it. Dependencies shouldn't be needed for something this simple. Each dependency is a potential security liability and another thing to maintain.

Versioning

Will follow semver. Major version every time a breaking change is introduced. Minor version on new features. Changes within a major version (e.g. 2.x and 2.y; y > x) will be backward compatible.

License

Licensed under Apache-2.0. Written and copyright by Iris Li.

Further information

I learned most my truecolor stuff from this awesome gist: https://gist.github.com/XVilka/8346728