New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@thednp/color

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thednp/color

🎨 Fast color conversion tool made in TypeScript

latest
Source
npmnpm
Version
1.0.14
Version published
Weekly downloads
2.8K
1.98%
Maintainers
1
Weekly downloads
 
Created
Source

Color

Coverage Status ci NPM Version NPM Downloads jsDeliver typescript version vitest version vite version

A TypeScript flavored fork of the excelent TinyColor optimized for ColorPicker with new features and improvements:

  • added support for HWB(a) colors (Hue, Whiteness, Blackness);
  • added support for CSS4 Color module (rgb(40 74 200 / 90%), hsl(227deg 67% 47% / 90%))
  • improved regular expressions;
  • tree shaking;
  • slightly faster performance;
  • stronger and more strict types.

Install

npm install @thednp/color

Quick Usage

import Color from "@thednp/color";

// provide a web colour, the constructor will determine
const myHEXColor = new Color("red", "hex").toString();
// => { r: 250, g: 0, b: 0, a: 1, ok: true, originalInput: 'red', ...}

// use the value where you need it
Object.assign(myElement.style, { color: myHEXColor.toString() });
// => #ff0000

Wiki

For a more detailed guide please visit the wiki page at Color Wiki!

Thanks

  • Brian Grinstead for his original TinyColor
  • Scott Cooper for his awesome version of TinyColor

License

Color is released under the MIT License

Keywords

color

FAQs

Package last updated on 28 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts