Socket
Socket
Sign inDemoInstall

rework

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rework - npm Package Compare versions

Comparing version 0.17.4 to 0.18.0

2

component.json
{
"name": "rework",
"version": "0.17.4",
"version": "0.18.0",
"description": "CSS manipulations built on CSSOM",

@@ -5,0 +5,0 @@ "keywords": ["css", "manipulation", "preprocess", "transform"],

0.18.0 / 2013-09-02
==================
* add HSV/HSB to RGB function "hsb()"
0.17.4 / 2013-08-22

@@ -3,0 +8,0 @@ ==================

@@ -10,14 +10,3 @@

/**
* Provide color manipulation helpers:
*
* button {
* background: rgba(#eee, .5)
* }
*
* yields:
*
* button {
* background: rgba(238, 238, 238, .5)
* }
*
* Provide color manipulation helpers.
*/

@@ -27,2 +16,11 @@

return functions({
/**
* Converts RGBA(color, alpha) to the corrosponding RGBA(r, g, b, a) equivalent.
*
* background: rgba(#eee, .5)
* background: rgba(white, .2)
*
*/
rgba: function(color, alpha){

@@ -37,4 +35,80 @@ if (2 == arguments.length) {

return 'rgba(' + args.join(', ') + ')';
},
/**
* Converts HSV (HSB) color values to RGB.
* Saturation and brightness can be expressed as floats or percentages.
*
* color: hsb(220, 45%, .3);
* color: hsb(220deg, 0.45, 30%);
*
*/
hsb: function (hue, saturation, value) {
var rgb = hsb2rgb(hue, saturation, value);
return 'rgb(' + rgb.join(', ') + ')';
},
/**
* Converts HSV (HSB) color values with alpha specified to RGBa.
* Saturation, brightness and alpha can be expressed as floats or
* percentages.
*
* color: hsba(220, 45%, .3, .4);
* color: hsba(220deg, 0.45, 30%, 40%);
*
*/
hsba: function (hue, saturation, value, alpha) {
alpha = /%/.test(alpha)
? parseInt(alpha, 10) / 100
: parseFloat(alpha, 10);
alpha = String(alpha).replace(/^0+\./, '.');
var rgb = hsb2rgb(hue, saturation, value);
return 'rgba(' + rgb.join(', ') + ', ' + alpha + ')';
}
});
};
/**
* HSB conversion.
*/
function hsb2rgb(hue, saturation, value) {
hue = (parseInt(hue, 10) || 0) % 360;
saturation = /%/.test(saturation)
? parseInt(saturation, 10) / 100
: parseFloat(saturation, 10);
value = /%/.test(value)
? parseInt(value, 10) / 100
: parseFloat(value, 10);
var rgb;
if (0 == saturation) return [value, value, value];
var side = hue / 60;
var chroma = value * saturation;
var x = chroma * (1 - Math.abs(side % 2 - 1));
var match = value - chroma;
switch (Math.floor(side)) {
case 0: rgb = [chroma, x, 0]; break;
case 1: rgb = [x, chroma, 0]; break;
case 2: rgb = [0, chroma, x]; break;
case 3: rgb = [0, x, chroma]; break;
case 4: rgb = [x, 0, chroma]; break;
case 5: rgb = [chroma, 0, x]; break;
default: rgb = [0, 0, 0];
}
rgb[0] = Math.round(255 * (rgb[0] + match));
rgb[1] = Math.round(255 * (rgb[1] + match));
rgb[2] = Math.round(255 * (rgb[2] + match));
return rgb;
}
{
"name": "rework",
"version": "0.17.4",
"version": "0.18.0",
"description": "CSS manipulations built on CSSOM",

@@ -5,0 +5,0 @@ "keywords": ["css", "manipulation", "preprocess", "transform"],

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