stylecow-plugin-msfilter-background-alpha
Advanced tools
Comparing version 2.0.0 to 3.0.0
39
index.js
@@ -6,26 +6,29 @@ var color = require('stylecow-color'); | ||
stylecow.addTask({ | ||
disable: { | ||
forBrowsersLowerThan: { | ||
explorer: 9.0 | ||
}, | ||
Declaration: { | ||
background: fixer, | ||
"background-color": fixer | ||
} | ||
}); | ||
}; | ||
filter: { | ||
type: 'Declaration', | ||
name: ['background', 'background-color'] | ||
}, | ||
fn: function (declaration) { | ||
var fn = declaration.searchFirst({ | ||
type: 'Function', | ||
name: ['rgba', 'hsla'] | ||
}); | ||
function fixer (declaration) { | ||
var fn = declaration.search({type: 'Function', name: ['rgba', 'hsla']}); | ||
if (fn) { | ||
var rgba = color.toRGBA(fn); | ||
if (fn.length === 1) { | ||
var rgba = color.toRGBA(fn[0]); | ||
if (rgba[3] === 1) { | ||
return fn.replaceWith(stylecow.Keyword.createFromString('#' + color.RGBA_HEX(rgba))); | ||
} | ||
if (rgba[3] === 1) { | ||
fn[0].replaceWith(new stylecow.Keyword('#' + color.RGBA_HEX(rgba))); | ||
} else { | ||
var hex = '#' + Math.round(255 * rgba[3]).toString(16) + color.RGBA_HEX(rgba); | ||
var hex = '#' + Math.round(255 * rgba[3]).toString(16) + color.RGBA_HEX(rgba); | ||
var filter = 'progid:DXImageTransform.Microsoft.gradient(startColorStr="' + hex + '", endColorStr="' + hex + '")'; | ||
declaration.parent({type: 'Rule'}).addOldMsFilter('progid:DXImageTransform.Microsoft.gradient(startColorStr="' + hex + '", endColorStr="' + hex + '")'); | ||
stylecow.utils.addMsFilter(declaration.parent('Block'), filter); | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
}; |
{ | ||
"name": "stylecow-plugin-msfilter-background-alpha", | ||
"description": "Stylecow plugin to add ms filters emulating the rgba/hsla colors in backgrounds in explorer < 9 using ms filters.", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"author": "Oscar Otero <oom@oscarotero.com>", | ||
@@ -14,5 +14,5 @@ "homepage": "https://github.com/stylecow/stylecow-plugin-msfilter-background-alpha", | ||
"dependencies": { | ||
"stylecow-color": "*" | ||
"stylecow-color": "2.*" | ||
}, | ||
"license": "MIT" | ||
} |
Floating dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
3577
27
1
Updatedstylecow-color@2.*