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

@skinnypete/color

v1.0.3

Published

A modern, fully fledged color toolkit

Downloads

495

Readme

@skinnypete/color

NPM

Build Status Codacy Badge MIT License Best Badge Purple

"What even is this? Why are you asking me what I think?"  —  Very Important, Real Person

Description

A true color manipulation and conversion library. Unlike some other libraries, this provides access directly to each color model, instead of relying on a single model to generate outputs. That means this library works within each color model to preform operations (some use conversion to make the process easier). This can ensure more accurate colors for sensitive projects, preform targeted manipulations on a single space, gives you more control in which model your color stays in, and much more.

Reasoning

Having used the Qix-/color for as long as I can remember when it comes to dealing with color libraries, and while it's a great library, I wanted to approach it from idea of treating each color model as a separate instance.Most available color libraries rely on a single color model and output values for various color models.

Features

  • Supports multiple color models (Ex. RGBA, HWB, HSL & HSV)
  • Accepts CSS color-names
  • Full of features and easy-to-use (Builder Pattern design)
  • Written in Typescript
  • Plenty of QOL enchantments
  • Works directly within the color space instead of relying on single color model to generate output values
  • Dependency free
  • Will not do your taxes, sorry...

Supported Color Spaces

  • RGBA
  • HSV
  • HWB
  • HSL
  • CMYK (Coming Soon)

Example

import { RGBA } from '@skinnypete/color';

const cssColor = RGBA.fromCssColor('RebeccaPurple');    // Accepts CSS Color Names
const shortHandHex = RGBA.fromHex('000');               // Can use shorthand hex values with and without hashtags
const hex = RGBA.fromHex('#663399');                    // Of course you can use hex (for any color space)
const rgb = RGBA.fromRGBA(102, 51, 153);                // Ability to pass in values (useful for external color space modfications)
const rgba = RGBA.fromRGBA(102, 51, 153, 0.44);         // Use alpha when applicable
const hslFromRGBA = RGBA.fromCssColor('RebeccaPurple')  // Easily switch between color models
    .toSpace('hsl');                                            

console.log(cssColor.toHexString());                     // #663399
console.log(shortHandHex.toArray());                     // [0,0,0,1]
console.log(rgb.toObject());                             // {"red":102,"green":51,"blue":153,"alpha":1}
console.log(rgb.toString());                             // rgb(102,51,153)
console.log(rgba.toString(true));                        // rgba(102,51,153,0.44)
console.log(hex.mix(shortHandHex.toObject(), 0.24)       // #4e2774
    .toString()); 
console.log(rgba.toHexString(true))                      // 663399
console.log(hslFromRGBA.toString());                     // hsl(270,50%,40%)

Installation

# NPM
npm install @skinnypete/color
# PNPM
pnpm install @skinnypete/color
# Yarn
yarn add @skinnypete/color