Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I set the background colour to transparent? #1164

Closed
ZTAP0011 opened this issue Jul 12, 2017 · 7 comments
Closed

How can I set the background colour to transparent? #1164

ZTAP0011 opened this issue Jul 12, 2017 · 7 comments
Labels

Comments

@ZTAP0011
Copy link

After setting the background in options to #ffffff, the colour of my canvas is white, it is okay, but the remaining area other than canvas image is transparent, how can I set that remaining area also to a colour e.g a white colour?

@ZTAP0011 ZTAP0011 changed the title How can I set the background colour to transparent How can I set the background colour to transparent? Jul 12, 2017
@niklasvh niklasvh added Bug and removed Bug labels Dec 11, 2017
@niklasvh niklasvh added this to In Progress in Backlog Dec 12, 2017
@niklasvh niklasvh moved this from In Progress to v1.0.0 in Backlog Dec 12, 2017
@niklasvh
Copy link
Owner

niklasvh commented Dec 12, 2017

You can set backgroundColor to null to make it transparent or any color to make the canvas render with the background color

@iamgoodbytes
Copy link

Here, changing the backgroundColor option has effect, but changing it to null creates a black background in the canvas, while there's no black background in my CSS.

@TheLeePriest
Copy link

I am also getting the canvas render a black background when setting backgroundColor to null

@weekitmo
Copy link

html2canvas(canvasDom, { allowTaint: true, useCORS: true, backgroundColor: "rgba(0,0,0,0)", removeContainer: true, x: 0, y: 0, width: 374, height: 722 })

@am-awais
Copy link

allowTaint: true with backgroundColor: "rgba(0,0,0,0)" Solved the problem

@Pawel-Janik
Copy link

I don't think allowTaint helps in any way with this issue. For me
backgroundColor: 'rgba(0, 0, 0, 0)', removeContainer: true,
settings were the ones needed.

@saransh0730
Copy link

saransh0730 commented Apr 4, 2024

How can I show my background image in the screenshot? The screenshot that it captures shows bg white. I've tried all the options for it, please suggest other libraries or something. The image is stored in my public folder of reactJS app and I've used backgroundImage tag in the body{}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants