Skip to content

Instantly share code, notes, and snippets.

@jneurock
Created September 5, 2016 18:14
Show Gist options
  • Save jneurock/850eec9ee1589f5a4cd81517b72a3017 to your computer and use it in GitHub Desktop.
Save jneurock/850eec9ee1589f5a4cd81517b72a3017 to your computer and use it in GitHub Desktop.
For any path having no stroke value but having a fill value, set the stroke value to the fill value
(function() {
var count = 0;
var i = 0;
var fill;
var path;
var paths = document.getElementsByTagName('path');
var pathsLen = paths.length;
var stroke;
while (i < pathsLen) {
path = paths[i];
fill = path.getAttribute('fill');
stroke = path.getAttribute('stroke');
if (fill && !stroke) {
console.info('Setting stroke color to fill color @path:' + i);
count++;
path.setAttribute('stroke', fill);
path.setAttribute('stroke-width', '1.25');
}
i++;
}
console.info('Modified ' + count + ' of ' + pathsLen + ' paths');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment