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

color-rgba

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color-rgba - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

index.mjs

12

index.js

@@ -7,5 +7,7 @@ /** @module color-rgba */

var hsl = require('color-space/hsl')
var clamp = require('clamp')
module.exports = function rgba (color) {
// template literals
if (Array.isArray(color) && color.raw) color = String.raw(...arguments)
var values, i, l

@@ -19,5 +21,5 @@

values = Array(3)
values[0] = clamp(parsed.values[0], 0, 255)
values[1] = clamp(parsed.values[1], 0, 255)
values[2] = clamp(parsed.values[2], 0, 255)
values[0] = Math.min(Math.max(parsed.values[0], 0), 255)
values[1] = Math.min(Math.max(parsed.values[1], 0), 255)
values[2] = Math.min(Math.max(parsed.values[2], 0), 255)

@@ -28,5 +30,5 @@ if (parsed.space[0] === 'h') {

values.push(clamp(parsed.alpha, 0, 1))
values.push(Math.min(Math.max(parsed.alpha, 0), 1))
return values
}
{
"name": "color-rgba",
"version": "2.1.1",
"version": "2.2.0",
"description": "Convert color string (or parseable argument) to RGBA array",
"main": "index.js",
"module": "./index.mjs",
"scripts": {
"test": "node test"
"test": "node test.mjs"
},
"exports": {
"import": "./index.mjs",
"require": "./index.js"
},
"repository": {

@@ -28,6 +33,5 @@ "type": "git",

"dependencies": {
"clamp": "^1.0.1",
"color-parse": "^1.3.8",
"color-parse": "^1.4.1",
"color-space": "^1.14.6"
}
}

@@ -16,2 +16,3 @@ # color-rgba [![Build Status](https://travis-ci.org/colorjs/color-rgba.png)](https://travis-ci.org/colorjs/color-rgba)

rgba('hsla(109, 50%, 50%, .75)') // [87.125, 191.25, 63.75, .75]
rgba`rgb(80 120, 160 / 50%)` // [80, 120, 160, .5]
```

@@ -18,0 +19,0 @@

Sorry, the diff of this file is not supported yet

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