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

flame-gradient

v1.0.0

Published

Input a number between 0 and 1, get an rgb value on a smooth gradient from dark to bright

Downloads

119,655

Readme

flame-gradient

This module generates flame gradients like this one:

banner

...going from dark almost-black red to bright almost-white yellow.

Usage

Get one rgb value for a specific decimal value:

const flameGradient = require('flame-gradient')

const rgb = flameGradient(0.6) // returns 'rgb(255, 150, 1)'
const rgba = flameGradient(0.6, 0.5) // returns 'rgba('255, 150, 1, 0.5)'

Generate an entire gradient:

const generate = require('flame-gradient/generate.js')

const arrayOf1000Rgbs = generate(1000)
console.log(arrayOf1000Rgbs)

generate(1000, (rgb) => {
  console.log(rgb) // Logs each of 1000 RGB gradient points
})

View a gradient with a set number of points in a new browser window:

# Defaults to 1000 slices
npm run view

# Set a number of slices
npm run view -- 15

Accessibility

These have been tested to have a good balance of vibrant colour and smooth progression in brightness, such that higher values appear brighter to a consistent amount, including in monohrome and across different types of colour vision deficiency (CVD). This is done by incrementing the R, G and B channels in slightly overlapping sine curves, each slightly stretched based on an approximation of that channel's relative luminosity.

As such they should be usable as colour scales in visualisations.

Examples using CoBlIs:

Monochrome (Achromatopsia):

Monochrome

Protanomaly ("red-weak"):

Protanomaly

Deuteranomaly ("green-weak"):

Deuteranomaly

Tritanomaly ("blue-weak"):

Tritanomaly

Protanopia ("red-blind"):

Protanopia

Deuteranopia ("green-blind")

Deuteranopia

Tritanopia ("blue-blind")

Tritanopia

Blue cone monochromacy

Blue cone monochromacy

Acknowledgements

Sponsored by nearForm

License

MIT