Skip to content

Commit

Permalink
Remove 🤖
Browse files Browse the repository at this point in the history
  • Loading branch information
Sak1012 committed Oct 14, 2023
1 parent 5e154d1 commit b970d94
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,6 @@ function App() {
console.log(`Copied to clipboard: ${hexCode}`);
});
};
const downloadAsImage = () => {
const paletteElement = colorPaletteRef.current;

if (paletteElement) {
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");

if (context) {
canvas.width = paletteElement.offsetWidth;
canvas.height = paletteElement.offsetHeight;

context.drawSvg(
new XMLSerializer().serializeToString(paletteElement),
0,
0,
);

const image = new Image();
image.src = canvas.toDataURL("image/png");

const a = document.createElement("a");
a.href = image.src;
a.download = "color_palette.png";
a.click();
}
}
};

return (
<>
<h1 className="text-5xl pb-4">Color Palette Generator</h1>
Expand Down Expand Up @@ -130,14 +102,7 @@ function App() {
Generate
</button>
</div>
<div>
<button
className="w-[100px] h-[50px] bg-mb border-4 border-black"
onClick={downloadAsImage}
>
download
</button>
</div>
<div></div>
<div>
<button
className="w-[100px] h-[50px] bg-mr border-4 border-black"
Expand Down

0 comments on commit b970d94

Please sign in to comment.