New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rgb-color-utils

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rgb-color-utils

A simple utils library for RGB colors which provides some convenient methods such as color interpolation, gradient generation, etc.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rgb-color-utils

A simple utils library for RGB colors which provides some convenient methods such as color interpolation, gradient generation, etc.

Installation

npm install rgb-color-utils

or

yarn add rgb-color-utils

Example Usage

import { parseColor, interpolate, gradientColor } from 'rgb-color-utils';

const colorList = parseColor('#cdab85'); // [205, 171, 133]
const newColor = interpolate('rgb(0, 23, 148)', '#febab5', 0.5); // '#7f69a5'
const colorMap = gradientColor('#bca380', '#00f', 4); // ['#bca380', '#8d7aa0', '#5e52c0', '#2f29df']

API

parseColor(color)

  • color one RGB/HEX color string (rgba(0, 23, 148) or #bf0081)

interpolate(from, to, step)

  • from the starting position RGB/HEX color string (rgba(0, 23, 148) or #bf0081)
  • to the end position color string
  • step the normalized value (between 0 and 1) of the interpolation. A step of 0.5 would be the middle of from and to

gradientColor(from, to, length)

  • from the starting position RGB/HEX color string (rgba(0, 23, 148) or #bf0081)
  • to the end position color string
  • length the length of the gradient colors array.

License

MIT License

Keywords

FAQs

Package last updated on 31 Oct 2017

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