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

moxy-color

v0.5.1

Published

Moxy Color

Downloads

2

Readme

moxy-rgb

Comprehensive color library for your web development needs. Inspired by W3Schools.com

Moxy Color Library

CSS Color Palettes

  • Crayola - Features the main 16 colors of Crayola Crayons
  • Flat UI - Features the main colors from the popular Flat UI theme
  • iPhone - Features the main colors of the iPhone 11
  • Metro - Features the main colors of Metro UI
  • Windows 8 - Features the main colors of Windows 8
  • xkcd - Features over 900 named colors by the xkcd website, found here.

Color palettes include CSS vars which can be included into styles via:

.className {
	color: var(--colorName);
}

or via the existing classes, eg:

<span class="c-red">Text color is red</span>
<span class="bg-red">Background color is red</span>

Color Palette Generation

For each of the below functions, input is a HEX-based color value or RGB array. Output returns an array of 5 colors (R, G, B) that work well together with the input color.

  • monochromaticColorPalette(color: string | number[]) - Returns different tones from the same hue.
  • analogousColorPalette(color: string | number[]) - Returns colors that are next to each other on the RYB color wheel.
  • complementaryColorPalette(color: string | number[]) - Returns colors that are on the opposite side of the RYB color wheel.
  • triadicColorPalette(color: string | number[]) - Returns colors made up of hues that are equally spaced around the color wheel.
  • compoundColorPalette(color: string | number[]) - Returns colors on both sides of the opposite hue.

Example use:

const { analogousColorPalette } = require('moxy-color')
console.log(monochromaticColorPalette('ff00ff'))
// returns an array of 5 colors, eg:
// [255, 179, 255]
// [255, 102, 255]
// [255, 26, 255]
// [204, 0, 204]
// [128, 0, 127]

Color conversion functions

  • hexFromRgb(r: number, g: number, b: number) - Converts RGB (red, green, and blue) to hex value (eg, 'ff0000')
  • hslToRgb(h: number, s: number, l: number) - Converts HSL (hue, saturation, and light) to RGB array
  • rgbFromHex(hex: string) - Converts HEX (eg, 'ff0000') to RGB array ([255, 0, 0])
  • rgbToHsl(r: number, g: number, b: number) - Converts RGB array to HSL

Helper functions

  • textColorFromBgColor(color: string | number[]) - Returns #fff or #000 depending on a specified background color (hex or RGB array) to ensure the text is readable.

Color Palettes

const { ColorPalette } = require('moxy-color')
// Below are the propeties of the ColorPalette object
{
	Assorted: { // Arrays
		AdriftInDreams,
		Compatible,
		CuriosityKilled,
		GiantGoldfish,
		GoodFriends,
		Terra,
		ThoughtProvoking,
	},
	Brands: { // Arrays
		Amazon,
		Android,
		CreativeCommons,
		Facebook,
		Google,
		IBM,
		Intagram,
		Intel,
		Microsoft,
		Netflix,
		Nintendo,
		Pepsi,
		Reddit,
		Twitter,
		Yahoo,
	},
	Themes: { // Key-Value objects with named colors
		FlatUI,
		Metro,
		Windows8,
	},
	xkcd, // Key-Value object with named colors
}

Color Wheels

const { ColorWheel } = require('moxy-color')
// Supports Cyan/Magenta/Yellow, Red/Green/Blue, and Red/Yellow/Blue Color Palettes
{
	CMY,
	RGB,
	RYB,
}