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 ๐Ÿ™

ยฉ 2026 โ€“ย Pkg Stats / Ryan Hefner

@igorskyflyer/common-color

v1.4.0

Published

๐ŸŽจ Provides common Color-related TypeScript types. ๐ŸŒˆ

Readme

๐Ÿ“ƒ Table of Contents

๐Ÿค– Features

  • ๐ŸŽจ Supports every major CSS color format and keyword
  • ๐ŸŒˆ Includes named colors, system colors, and special keywords
  • ๐Ÿ”ข Handles HEX, RGB(A), HSL, HWB, Lab, LCH, OKLab, and OKLCH
  • ๐ŸŒ€ Covers gradients: linear, radial, conic, and repeating variants
  • โšก Supports modern CSS functions like color-mix, light-dark, device-cmyk, color-contrast
  • ๐Ÿ“š Typed definitions for CSS Color Modules Level 3โ€“6
  • ๐Ÿ›ก Strong TypeScript typing for accuracy and autocomplete

๐Ÿ•ต๐Ÿผ Usage

Install it by executing any of the following, depending on your preferred package manager:

pnpm add @igorskyflyer/common-color
yarn add @igorskyflyer/common-color
npm i @igorskyflyer/common-color

๐Ÿคน๐Ÿผ API

๐Ÿค– Constants

SpecialColor

Technically, keywords - not colors per se, they provide ways of using special colors: currentcolor, transparent, initial, inherit and unset.

Each of them has a special meaning for the browser:

  • currentcolor: the current color of the element
  • transparent: a fully transparent color
  • initial: the default value defined by the browser
  • inherit: inherits the color from the parent element
  • unset: resets the property to its natural value, either inherited or initial

SystemColor

This type represents a set of system-defined color keywords that correspond to system UI elements, which can adapt based on the user's operating system and theme settings.

Includes keywords like: AccentColor, AccentColorText, ActiveText, ButtonBorder, ButtonFace, etc.

[!TIP] Learn more about SystemColor External link on MDN.


NamedStandardColor

Common and standardized color identifiers. Includes values like: black, silver, gray, white, maroon, red, etc.


NamedExtendedColor

Includes all of the colors defined by NamedStandardColor and 131 colors more, values like: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, etc.


๐Ÿ“œ Template literals

[!CAUTION] The following types are derived from a template literal type, the types do NOT validate the actual color.


HexColor

A template literal type that adheres to the format #${string}, effectively representing a Hex color.


RgbColor

A template literal type that adheres to the format rgb(${string}), effectively representing an RGB color.


RgbaColor

A template literal type that adheres to the format rgba(${string}), effectively representing an RGBA color.


HslColor

A template literal type that adheres to the format hsl(${string}), effectively representing an HSL color.


HwbColor

A template literal type that adheres to the format hwb(${string}), effectively representing an HWB color.


LabColor

A template literal type that adheres to the format lab(${string}), effectively representing a LAB color.


LchColor

A template literal type that adheres to the format lch(${string}), effectively representing a LCH color.


OklabColor

A template literal type that adheres to the format oklab(${string}), effectively representing an Oklab color.


OklchColor

A template literal type that adheres to the format oklch(${string}), effectively representing an Oklch color.


LightDarkColor

A template literal type that adheres to the format light-dark(${string}), effectively representing a light-dark color.


ColorMix

A template literal type that adheres to the format color-mix(${string}), effectively representing a color-mix.


DeviceCmyk

A template literal type that adheres to the format device-cmyk(${string}), effectively representing a device-cmyk color.


ColorContrast

A template literal type that adheres to the format color-contrast(${string}), effectively representing a color-contrast color.


Gradients

[!TIP] Gradients are supported from v1.1.0.


LinearGradient

A template literal type that adheres to the format linear-gradient(${string}), effectively representing a linear gradient.


RadialGradient

A template literal type that adheres to the format radial-gradient(${string}), effectively representing a radial gradient.


ConicGradient

A template literal type that adheres to the format conic-gradient(${string}), effectively representing a conic gradient.


RepeatingLinearGradient

A template literal type that adheres to the format repeating-linear-gradient(${string}), effectively representing a repeating linear gradient.


RepeatingRadialGradient

A template literal type that adheres to the format repeating-radial-gradient(${string}), effectively representing a repeating radial gradient.


RepeatingConicGradient

A template literal type that adheres to the format repeating-conic-gradient(${string}), effectively representing a repeating conic gradient.


๐Ÿฆ„ Special


Color

A broad color type that includes all of the previously mentioned color types:


ColorWithKeywords

An even broader color type that includes the Color type (and all of the previously mentioned color types) with the addition of colors from the SpecialColor type.


ColorExtended

The most broad color type that includes the ColorWithKeywords type (and all of the previously mentioned color types) with the addition of colors from the SystemColor type.


CSS levels

In addition to using any color type, since v1.2.0 it is possible to narrow the color types to a certain CSS color module level An external link.


CssLevel3Color

Includes the following CSS color module level 3 types:


CssLevel4Color

Includes previously mentioned CSS color module level 3 types and the following CSS color module level 4 types:


CssLevel5Color

Includes previously mentioned CSS color module level 4 types and the following CSS color module level 5 types:


CssLevel6Color

Includes previously mentioned CSS color module level 5 types and the following CSS color module level 6 types:

๐Ÿ—’๏ธ Examples

ui.ts

import type { Color } from '@igorskyflyer/common-color'

const uiColor: Color = '#0099ff' // ok, now do something with the Hex color
const uiScrollbar: Color = 'rfb(0, 128, 255)' // will trigger an ERROR
                  // (typo, rFb instead of rGb)

๐Ÿ“ Changelog

๐Ÿ“‘ The changelog is available here, CHANGELOG.md.

๐Ÿชช License

Licensed under the MIT license which is available here, MIT license.

๐Ÿ’– Support

๐Ÿงฌ Related

@igorskyflyer/unc-path

๐Ÿฅฝ Provides ways of parsing UNC paths and checking whether they are valid. ๐ŸŽฑ

@igorskyflyer/keppo

๐ŸŽก Parse, manage, compare and output SemVer-compatible version numbers. ๐Ÿ›ก

@igorskyflyer/jmap

๐Ÿ•ถ๏ธ Reads a JSON file into a Map. ๐ŸŒป

@igorskyflyer/zing

๐ŸŒ Zing is a C# style String formatter for JavaScript that empowers Strings with positional arguments - composite formatting. ๐Ÿš€

@igorskyflyer/duoscribi

โœ’ DรบรถScrรญbรฎ allows you to convert letters with diacritics to regular letters. ๐Ÿค“

๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป Author

Created by Igor Dimitrijeviฤ‡ (@igorskyflyer).