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

postcss-color-rebeccapurple

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-rebeccapurple - 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)

49

index.js

@@ -5,22 +5,17 @@ /**

var color = require("color")
var helpers = require("postcss-message-helpers")
/**
* PostCSS plugin to convert colors
*
* @param {Object} options
*/
module.exports = function plugin(options) {
options = options || {}
options.rebeccapurple = options.rebeccapurple !== undefined ? options.rebeccapurple : true
options.hwb = options.hwb !== undefined ? options.hwb : true
options.hexAlpha = options.hexAlpha !== undefined ? options.hexAlpha : true
options.color = options.color !== undefined ? options.color : true
module.exports = function plugin() {
return function(style) {
style.eachDecl(function transformDecl(dec) {
if (!dec.value) {
style.eachDecl(function transformDecl(decl) {
if (!decl.value || decl.value.indexOf("rebeccapurple") === -1) {
return
}
dec.value = transform(dec.value, dec.source, options)
decl.value = helpers.try(function transformRebeccapurpleValue() {
return transformRebeccapurple(decl.value)
}, decl.source)
})

@@ -30,23 +25,3 @@ }

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

@@ -61,11 +36,1 @@ * Transform rebeccapurple color to rgb()

}
/**
* 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-rebeccapurple",
"version": "1.0.0",
"version": "1.1.0",
"description": "PostCSS plugin to transform W3C CSS rebeccapurple color to more compatible CSS (rgb())",

@@ -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 @@ },

@@ -5,5 +5,10 @@ # postcss-color-rebeccapurple [![Build Status](https://travis-ci.org/postcss/postcss-color-rebeccapurple.png)](https://travis-ci.org/postcss/postcss-color-rebeccapurple)

## Why this plugin ?
If you did some CSS, I'm sure you know who [Eric Meyer](https://en.wikipedia.org/wiki/Eric_A._Meyer) is, & what he did for this language.
In memory of [Eric Meyer’s daughter](http://meyerweb.com/eric/thoughts/2014/06/09/in-memoriam-2/), [W3C added new color rebeccapurple to CSS 4 Color Module](http://lists.w3.org/Archives/Public/www-style/2014Jun/0312.html).
## Installation
```bash
```console
$ npm install postcss-color-rebeccapurple

@@ -55,6 +60,8 @@ ```

$ git clone https://github.com/postcss/postcss-color-rebeccapurple.git
$ git checkout -b patch-1
$ npm install
$ npm test
```console
$ git clone https://github.com/postcss/postcss-color-rebeccapurple.git
$ git checkout -b patch-1
$ npm install
$ npm test
```

@@ -61,0 +68,0 @@ ## [Changelog](CHANGELOG.md)

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