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

postcss-js-mixins

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-js-mixins - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

25

lib/helpers.js

@@ -29,4 +29,3 @@ const tinycolor = require('tinycolor2');

/**
* Convert hex values to RGBa. Can accept both three and
* size letter hex.
* Convert color values to RGBa
*

@@ -37,22 +36,10 @@ * @param {string} color

*/
function hexToRgba(color, opacity = false) {
color = color.replace('#', '');
function toRgba(color, opacity = false) {
color = tinycolor(color);
if (opacity !== false) {
opacity = calcOpacity(opacity);
}
if (color.length === 3) {
color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];
}
let r = parseInt(color.substring(0,2), 16),
g = parseInt(color.substring(2,4), 16),
b = parseInt(color.substring(4,6), 16);
if (opacity) {
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
color.setAlpha(calcOpacity(opacity));
}
return `rgb(${r}, ${g}, ${b})`;
return color.toRgbString();
}

@@ -238,3 +225,2 @@

calcOpacity: calcOpacity,
hexToRgba: hexToRgba,
isColor: isColor,

@@ -253,4 +239,5 @@ isEmpty: isEmpty,

toPercentage: toPercentage,
toRgba: toRgba,
type: type,
unit: unit
};
{
"name": "postcss-js-mixins",
"version": "2.2.1",
"version": "2.3.0",
"description": "PostCSS plugin for custom mixin syntax",

@@ -5,0 +5,0 @@ "main": "index.js",

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