Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@daeinc/color

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daeinc/color

Color utilities

  • 0.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@daeinc/color

Color utilities. Mostly wrapper functions on existing packages for convenience.

npm i @daeinc/color

then,

import { hsv2rgb, ... } from "@daeinc/color"

Functions

hsv2rgb

function hsv2rgb(val: number): number[];
function hsv2rgb(arr: number[]): number[];
function hsv2rgb(h: number, s: number, v: number): number[];
function hsv2rgb(
  h: number,
  s: number,
  v: number,
  a: number
): number[];

Converts HSV/HSB color to RGB. Each channel of the input HSV color must be normalized to [0, 1] range.

A typical usage is as follows:

ctx.strokeStyle = `rgb(${hsv2rgb(0, 1, 1)})` // red

hsb2rgb

const hsb2rgb: typeof hsv2rgb;

Alias for hsv2rgb.

rgb2hsv

function rgb2hsv(arr: number[]): number[];
function rgb2hsv(r: number, g: number, b: number): number[];
function rgb2hsv(
  r: number,
  g: number,
  b: number,
  a: number
): number[];

Converts RGB color to HSV. The out color is normalized to [0, 1] range.

hex2rgb

function hex2rgb(hex: string): number[];

Converts HEX color string to RGB color.

To dos

  • add
    • rgb2hsl and hsl2rgb
    • hex2hsv
  • try
    • color-functions
    • color-normalize

License

MIT

FAQs

Package last updated on 16 Nov 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc