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

@appres/color

v0.1.8

Published

Value and JSON for the Color

Downloads

45

Readme

Value and JSON for the Color

Install

npm i @appres/color

Import

const Color = require('@appres/color');

or 

import { Color } from '@appres/color';

Usage

function: val
    Color.val("color name");
    Color.val("#color");
    Color.val(value);
    Color.val(value, a);
    Color.val(value, alpha);
    Color.val(r, g, b);
    Color.val(r, g, b, a);
    Color.val(r, g, b, alpha);
    Color.val({json});

return:
    type:   number
            value is color value with alpha
    ex: 
            as hex
                0xff00ff7f
            as decimal
                4278255487


function: json
    Color.json("color name");
    Color.json("#color");
    Color.json(value);
    Color.json(value, a);
    Color.json(value, alpha);
    Color.json(r, g, b);
    Color.json(r, g, b, a);
    Color.json(r, g, b, alpha);

return:
    type:   json
    ex; 
        {
            r: 255,
            g: 0,
            b: 255,
            a: 127            
        }

color name

    lightred
    red	
    darkred

    lightgreen
    green
    darkgreen

    lightblue
    blue	
    darkblue    

    lightyellow	
    yellow	
    darkyellow	

    white 
    black	    
    
    silver	    

    lightgray	
    gray	
    darkgray	
    
    maroon    
    olive	
    lime        
    aqua	
    teal
    navy	
    fuchsia	
    purple

Samples

Color.val("red");       // 0xac0000ff
Color.val("lightred");  // 0xff0000ff
Color.val("darkred");   // 0x640000ff

Color.val("#F0F");      // 0xff00ffff
Color.val("#F0F", 0.5); // 0xff00ff80
Color.val("#F0F7");     // 0xff00ff77
Color.val("#FF00FF");   // 0xff00ffff
Color.val("#FF00FF", 0.5);      // 0xff00ff80
Color.val("#FF00FF7F"); // 0xff00ff7f
Color.val(0xff00ff);    // 0xff00ffff
Color.val(0xff00ff7f);  // 0xff00ff7f
Color.val(0xff00ff, 0.5);       // 0xff00ff80
Color.val(0xff00ff, 0x7f);      // 0xff00ff7f
Color.val(255, 0, 255); // 0xff00ffff
Color.val(255, 0, 255, 127);    // 0xff00ff7f
Color.val(255, 0, 255, 0.5);    // 0xff00ff80
Color.val(0xff, 0x00, 0xff);    // 0xff00ffff
Color.val(0xff, 0x00, 0xff, 0x7f);      // 0xff00ff7f
Color.val(0xff, 0x00, 0xff, 0.5);       // 0xff00ff80
Color.val({r: 255, g: 0, b: 255, a: 127});      // 0xff00ff7f
Color.val({r: 0xff, g: 0x00, b: 0xff, a: 0x7f});        // 0xff00ff7f
Color.val({r: 255, g: 0, b: 255, alpha: 0.5});  // 0xff00ffff
Color.val({r: 0xff, g: 0x00, b: 0xff, alpha: 0.5});     // 0xff00ffff

Color.json("red");      // {"r":172,"g":0,"b":0,"a":255}
Color.json("lightred"); // {"r":255,"g":0,"b":0,"a":255}
Color.json("darkred");  // {"r":100,"g":0,"b":0,"a":255}

Color.json("#F0F");     // {"r":255,"g":0,"b":255,"a":255}
Color.json("#F0F", 0.5);        // {"r":255,"g":0,"b":255,"a":128}
Color.json("#F0F7");    // {"r":255,"g":0,"b":255,"a":119}
Color.json("#FF00FF");  // {"r":255,"g":0,"b":255,"a":255}
Color.json("#FF00FF", 0.5);     // {"r":255,"g":0,"b":255,"a":128}
Color.json("#FF00FF7F");        // {"r":255,"g":0,"b":255,"a":127}
Color.json(0xff00ff);   // {"r":255,"g":0,"b":255,"a":255}
Color.json(0xff00ff7f); // {"r":255,"g":0,"b":255,"a":127}
Color.json(0xff00ff, 0.5);      // {"r":255,"g":0,"b":255,"a":128}
Color.json(0xff00ff, 0x7f);     // {"r":255,"g":0,"b":255,"a":127}
Color.json(255, 0, 255);        // {"r":255,"g":0,"b":255,"a":255}
Color.json(255, 0, 255, 127);   // {"r":255,"g":0,"b":255,"a":127}
Color.json(255, 0, 255, 0.5);   // {"r":255,"g":0,"b":255,"a":128}
Color.json(0xff, 0x00, 0xff);   // {"r":255,"g":0,"b":255,"a":255}
Color.json(0xff, 0x00, 0xff, 0x7f);     // {"r":255,"g":0,"b":255,"a":127}
Color.json(0xff, 0x00, 0xff, 0.5);      // {"r":255,"g":0,"b":255,"a":128}
Color.json(4278255487); // {"r":255,"g":0,"b":255,"a":127}