Hacker News new | ask | show | jobs
by kejaed 2138 days ago
As I opened this on my phone I thought that these would make a nice background image.

While I recognize that the whole premise is that CSS gradients are better suited than images for their intended purpose, I immediately looked to see if the website offered a way to render an image and download it. Or perhaps even turn off the UI and have a no chrome view so one could take a screenshot.

Perhaps this could be a monetization strategy, instant gratification download for $1 with low friction Apple/Google Pay (perhaps watermark removal). I know this wasn’t anywhere near the intended purpose of your project, it is just what came to mind for something I might pay for when seeing it.

1 comments

Great idea! I've considered adding an option to download individual gradients as an image, but I haven't thought about that as the primary focus. Certainly the number of people interested in cool backgrounds is going to be much larger than the current audience of frontend web developers.

The cool thing is that the two target audiences aren't mutually exclusive. So long as I continue to build out the images in CSS, I can offer both image and CSS download options.

FWIW html2canvas is pretty good for all html-screenshotty things. Might work here as well.

https://html2canvas.hertzen.com/

Good as html2canvas is, these days you may get more milage creating an SVG, putting the HTML content in it as a ForeignObject, and then using the browser's ability to copy an image to a canvas with the SVG as the source. I use that technique in a very complex diagramming app I work on and it never seems to fail regardless of the HTML content. Getting fonts and external styles to work is fun but that wouldn't apply here.
Off-topic, but please tell us more about the diagramming app.
Come to think of it, CSS isn't its strongest side. No support for filters I think. Maybe worth checking it out anyway.
I looked into it before, and I don't think html2canvas would work. IIRC the only way to get the gradients was using the screen capture API [1], which works, but requires users to click an authorization prompt before use.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capt...

Hm. I've used image-screenshot [1] in the past together with html2canvas to get CSS filter support in screenshots. Don't know if it would work in your scenario though.

[1] https://www.npmjs.com/package/image-screenshot