mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
feat: Add function to create striped canvas pattern
This commit is contained in:
parent
a47a5c9179
commit
9b2f317ba3
1 changed files with 22 additions and 0 deletions
|
@ -76,6 +76,28 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function createStripedCanvas(isStrict) {
|
||||||
|
const patternCanvas = document.createElement('canvas');
|
||||||
|
const patternContext = patternCanvas.getContext('2d');
|
||||||
|
const size = 10;
|
||||||
|
patternCanvas.width = size;
|
||||||
|
patternCanvas.height = size;
|
||||||
|
|
||||||
|
patternContext.fillStyle = 'rgba(255, 99, 132, 0.8)';
|
||||||
|
patternContext.fillRect(0, 0, size, size);
|
||||||
|
|
||||||
|
if (isStrict) {
|
||||||
|
patternContext.strokeStyle = 'rgba(255, 255, 255, 0.8)';
|
||||||
|
patternContext.lineWidth = 2;
|
||||||
|
patternContext.beginPath();
|
||||||
|
patternContext.moveTo(0, 0);
|
||||||
|
patternContext.lineTo(size, size);
|
||||||
|
patternContext.stroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
return patternCanvas;
|
||||||
|
}
|
||||||
|
|
||||||
new Chart(ctx, config);
|
new Chart(ctx, config);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue