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

month-colors

v0.0.1

Published

Get changing colors for a Date

Downloads

5

Readme

Month-Colors

Get changing color gradients for a Date. Zero dependencies. Very pretty.

Check out a preview here. Inspired by Sony's XMB.

Usage

var monthColors = require('month-colors');
var october = new Date('2000-10-15 12:00');

monthColors.gradient(october);
// => [ { r: 221, g: 191, b: -8.47832399409706e-16 },  { r: 228, g: 152, b: 6.999999999999999 } ].  
// A pretty pair of orange colors for the fall season :)
// Note that these are not rounded.

monthColors.gradient(october,'hex')
// =>[ 14532352, 14981127 ], same as [0xddbf00,0xe49807]

monthColors.gradientCss(october);
// => 'radial-gradient(rgb(221,191,0) 0%,rgb(228,152,7) 100%)'

monthColors.filter(october,'hex')
// => 0xe5a708.  A slightly darker orange for text shadows, etc

monthColors.daylight(october)
// => 1 .  This represents full sun, since it's at noon

monthcolors.daylight(new Date('2000-10-15 20:00'))
// => 0.2332582478842018 .  Lower amount of light at night.

API

monthColors.gradient(date,[format])

Returns a pair of colors corresponding to a date. Format is a String, and is either "hex" or "rgb" (assumed to be RGB format by default).

monthColors.filter(date,[format])

Returns a color corresponding to a date. This color will be similar to the gradient colors. Format is a String, and is either "hex" or "rgb" (assumed to be RGB format by default).

monthColors.gradientCss(date)

Returns a css radial-gradient corresponding to a date.

monthColors.daylight(date)

Returns an approximate amount of daylight at the time, as a number between 0 and 1 inclusive. Doesn't account for latitude or anything, it just goes up and down with the clock, maxing out at noon and bottoming out at midnight.

Building / testing

test with npm test build with npm run-script browser-build (browserify ^13.1.0 works)

that's literally it