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

postcss-color-hex-alpha

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-color-hex-alpha - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

CHANGELOG.md

@@ -0,3 +1,7 @@

# 1.1.0 - 2014-11-25
- Enhanced exceptions
# 1.0.0 - 2014-10-04
Initial release from [postcss-color](https://github.com/postcss/postcss-color)

40

index.js

@@ -5,2 +5,3 @@ /**

var color = require("color")
var helpers = require("postcss-message-helpers")

@@ -18,8 +19,10 @@ /**

return function(style) {
style.eachDecl(function transformDecl(dec) {
if (!dec.value) {
style.eachDecl(function transformDecl(decl) {
if (!decl.value || decl.value.indexOf("#") === -1) {
return
}
dec.value = transform(dec.value, dec.source)
decl.value = helpers.try(function transformHexAlphaValue() {
return transformHexAlpha(decl.value, decl.source)
}, decl.source)
})

@@ -30,23 +33,2 @@ }

/**
* Transform colors to rgb() or rgba() on a declaration value
*
* @param {String} string
* @return {String}
*/
function transform(string, source) {
// order of transformation is important
try {
if (string.indexOf("#") > -1) {
string = transformHexAlpha(string, source)
}
}
catch (e) {
throw new Error(gnuMessage(e.message, source))
}
return string
}
/**
* transform RGBA hexadecimal notations (#RRGGBBAA or #RGBA) to rgba().

@@ -95,11 +77,1 @@ *

}
/**
* return GNU style message
*
* @param {String} message
* @param {Object} source
*/
function gnuMessage(message, source) {
return (source ? (source.file ? source.file : "<css input>") + ":" + source.start.line + ":" + source.start.column : "") + " " + message
}
{
"name": "postcss-color-hex-alpha",
"version": "1.0.0",
"version": "1.1.0",
"description": "PostCSS plugin to transform W3C RGBA hexadecimal notations (#RRGGBBAA or #RGBA) to more compatible CSS (rgba())",

@@ -23,7 +23,7 @@ "keywords": [

"LICENSE",
"README.md",
"index.js"
],
"dependencies": {
"color": "^0.7.1"
"color": "^0.7.1",
"postcss-message-helpers": "^1.1.0"
},

@@ -33,3 +33,3 @@ "devDependencies": {

"jshint": "^2.5.6",
"postcss": "^2.2.5",
"postcss": "^3.0.0",
"tape": "^3.0.0"

@@ -36,0 +36,0 @@ },

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