patternomaly
patternomaly copied to clipboard
Pre-packaged .js file
Is it possible to get a packaged (post babel etc) single file version of this, that can just be included in the html?
I've tried installing and babelling/webpacking it myself, but every bundle results in a "pattern is not defined" error, even though it appears all the code is there. Same error whether i put the pattern.draw() in the bundle.js or as a separate file after the patternomaly.bundle.js.)
i've found only this https://unpkg.com/[email protected]/dist/patternomaly.js
I ran the npm and these are the files created if anyone needs them. patternomaly.zip
Just to expand on @baterflyrity's answer above, usage would be:
<script src="https://unpkg.com/[email protected]/dist/patternomaly.js"></script>
var colors = [
'#1f77b4',
'#e377c2',
'#ff7f0e',
'#2ca02c'
];
var patterns = pattern.generate(colors);
const myChart = new Chart(ctx, {
type: 'pie',
data: {
labels: [...
// And then...
myChart.data.datasets[0].backgroundColor = patterns;
myChart.update();