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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@lorenzopuppo95/super-color

v1.0.0

Published

library for color functionalities

Downloads

5

Readme

Functions

random([a])

The function random generates a random color with optional alpha value.

Kind: global function
Returns: A new UColor object is being returned with random values for red (r), green (g), blue (b), and alpha (a) components. The alpha component (a) is a random value between 0 and 1, while the red, green, and blue components (r, g, b) are random integers between 0 and 255.

| Param | Description | | --- | --- | | [a] | The parameter a in the random function is a value between 0 and 1 representing the alpha channel (transparency) of the color. It is generated randomly using Math.random() and rounded to three decimal places. |

fromHEX(hexString)

The function fromHEX converts a hexadecimal color string to RGBA values.

Kind: global function
Returns: The fromHEX static method is returning a new UColor object with the red, green, blue, and alpha values extracted from the input hexString. The red, green, and blue values are extracted from the hexString by parsing substrings of the hexString, and the alpha value is calculated based on the length of the hexString.

| Param | Description | | --- | --- | | hexString | The hexString parameter is a string representing a color in hexadecimal format. It can be in the format #RRGGBB for RGB colors or #RRGGBBAA for RGBA colors, where: |

fromRGBA(rgbaString)

The function fromRGBA parses an RGBA string to extract the red, green, blue, and alpha values, then creates a new UColor object with these values.

Kind: global function
Returns: An instance of the UColor class with the red, green, blue, and alpha values extracted from the input rgbaString.

| Param | Description | | --- | --- | | rgbaString | The rgbaString parameter is a string representing a color in RGBA format. It typically looks like rgba(r, g, b, a) where r, g, b are integers representing the red, green, and blue color channels respectively, and a is alpha. |

toHEX()

The function toHEX() converts RGB and alpha values to a hexadecimal color representation.

Kind: global function
Returns: The toHEX() function is returning a hexadecimal representation of the color values stored in the object. If the alpha value (a) is equal to 1, it returns the hexadecimal representation of the RGB values. If the alpha value is not 1, it also includes the alpha value in the hexadecimal representation.

toRGBA()

The toRGBA() function returns a string representing the RGBA values of a color.

Kind: global function
Returns: The toRGBA() method is returning a string in the format rgba(r, g, b, a) where r, g, b, and a are the values of the red, green, blue, and alpha components respectively.

getGrayScale()

The getGrayScale function calculates the grayscale value of a color based on its RGB components.

Kind: global function
Returns: A new UColor object with the grayscale values for red, green, and blue channels, and the original alpha value.

getContrastColor()

The function getContrastColor calculates a contrasting color based on the input RGB color array.

Kind: global function
Returns: A new UColor object with the RGB values of the color that is the contrast of the original color.

getPalette()

The function getPalette generates a color palette based on the input colors by adjusting the hue values.

Kind: global function
Returns: The getPalette function returns an array of UColor objects. The array contains the original color from this.colorsArray converted to HSL and then back to RGB, as well as two additional colors with slightly adjusted hues.

rgbToHsl(r, g, b)

The function rgbToHsl converts RGB values to HSL (Hue, Saturation, Lightness) values in JavaScript.

Kind: global function
Returns: The function rgbToHsl is returning an array containing the HSL (Hue, Saturation, Lightness) values calculated from the input RGB values. The array contains three elements: the rounded H (Hue) value, the rounded S (Saturation) value, and the rounded L (Lightness) value.

| Param | Description | | --- | --- | | r | The r, g, and b parameters in the rgbToHsl function represent the red, green, and blue values of a color respectively. These values are typically in the range of 0 to 255, where 0 represents the absence of that color and | | g | The g parameter in the rgbToHsl function represents the green component of an RGB color. In the RGB color model, colors are created by mixing different intensities of red, green, and blue light. The g parameter specifies the intensity of the green light in the | | b | The b parameter in the rgbToHsl function represents the blue component of an RGB color. In the RGB color model, colors are created by mixing different intensities of red, green, and blue light. The b parameter is the intensity of the blue light in the |

hslToRgb(h, s, l)

The function hslToRgb converts HSL (Hue, Saturation, Lightness) color values to RGB (Red, Green, Blue) color values.

Kind: global function
Returns: The function hslToRgb returns an array of three values representing the RGB values of a color converted from HSL (Hue, Saturation, Lightness) format.

| Param | Description | | --- | --- | | h | Hue value in the range of 0 to 360. | | s | The s parameter in the hslToRgb function stands for the saturation value in the HSL (Hue, Saturation, Lightness) color model. It represents the intensity of the color. In the function, the s parameter is divided by 100 to normalize | | l | The l parameter in the hslToRgb function represents the lightness value in the HSL (Hue, Saturation, Lightness) color model. It ranges from 0 to 100, where 0 is black and 100 is white. |