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

js-tool-color

v1.0.1

Published

A library of lightweight, dexterous, yet powerful color processing tool

Downloads

6

Readme

Color-Tool

Color tool is a library of color processing tools that supports HXL, RGB, HSL format processing and conversion, provides a variety of color blending, extraction, linear change, random generation, interpolation, similarity analysis, accent color generation, and supports 140 browser-supported default colors and multiple sets of colors

Installation


npm install js-tool-color

Usage


//First import the Color-tool library
const Color = require('js-tool-color');

//You can then use the methods in the library
let checkColor = Color.checks('rgba(255,255,255,1)')

//It is worth noting that if you try to extend a method with a plugin, be sure to execute the following code before using the method
const yourPlugin = {} //Your plugin
Color.plugin(yourPlugin).run()

Api

| name | parameters | description | |-------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | addDefine | key,value | Adds a color definition. | | blending | colors,colors,type | Blends multiple colors together according to a specified blending mode. | | changeColor | color | This function changes the value of a single color channel (red, green, blue, alpha) in a given color. | | check | color | Color detection, standardized processing methods | | checks | color | This function accepts a color string, identifies its type (Hex, RGB, RGBA, HSL, HSLA), and returns a new object containing the color's value in different formats and some related functions. | | colorTheme | color,theme,type | Generates colors following a certain theme. | | complement | color,type | This function returns the complementary color of the given color. | | contrast | colors,contrast,type | This function adjusts the contrast of an array of colors. | | getColor | color | Returns a color value from the color definitions, if it exists. | | getThemeColors | type, theme | Gets a specific color set from a theme. | | hslaAdjustment | color,type | This function adjusts the HSLA values of a given color. | | inversion | color,type | This function inverts the color and alpha channel of a given color. | | labToRgb | color | Converts a Lab color to an RGB color. | | lerpColor | color1, color2, t, name, type | This function performs a linear interpolation between two colors based on a given ratio. | | linearColor | start, end, interval | Generates a function that gives the linear interpolated color at a specific time. | | linearColors | color1, color2, interval, type | Generates a function that returns linear interpolated colors between two colors for a specific time. | | multilinearColor | colors, interval | Generates a function that returns multilinear interpolated colors among several colors for a specific time. | | multilinearColors | colors, interval, type | Generates a function that returns multilinear interpolated colors among several colors for a specific time. | | plugin | plugs | Registers plugins to the library. | | randomColor | start, end | Generates a random color within the given range. | | removeDefine | key | Removes a color definition. | | rgbToLab | color | Converts an RGB color to a Lab color. | | seqLevels | color1, color2, levels, type | Creates a sequence of color levels between two colors. | | shade | color, percentage, type | This function shades a color by mixing it with black using linear interpolation. | | similarityHsla | color1, color2 | This function calculates the similarity between two colors in the HSLA color space. | | similarityRgba | color1, color2 | This function calculates the similarity between two colors in the RGBA color space. | | tint | color, percentage, type | This function tints a color by mixing it with white using linear interpolation. | | toType | color, type | Converts a color to a specific color format. | | transformation | color | Transforms the input color from rgb to hex or vice versa. |

For complete API documentation, see API documentation

License

This project is licensed under the MIT License - see the LICENSE file for details