petersolopov / carbonara

API for carbon
MIT License
125 stars 32 forks source link

Add transparent background support #7

Closed cosmicle0 closed 3 years ago

cosmicle0 commented 3 years ago

Hi there,

I'd like to see transparent background to be implemented, It is possible if i set alpha to 0 in the rgba option, but I don't think puppeteer takes transparent screenshots.

Thanks, cosmicice

petersolopov commented 3 years ago

Fixed. Check it:

curl https://carbonara.now.sh/api/cook \
-X POST \
-H 'Content-Type: application/json' \
-d '{
      "code": "export default const sum = (a, b) => a + b",
      "backgroundColor": "rgba(31,129,109,0)"
    }' \
> transparent.png
cosmicle0 commented 3 years ago

Thanks a lot!

~cosmicice