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

Prefill whole canvas with color #37

Open
rajdeepbhatia opened this issue Apr 18, 2020 · 2 comments
Open

Prefill whole canvas with color #37

rajdeepbhatia opened this issue Apr 18, 2020 · 2 comments

Comments

@rajdeepbhatia
Copy link

rajdeepbhatia commented Apr 18, 2020

Hi, I am trying to prefill the whole canvas with white color by doing this, but it isn't working

var ctx = $('#canvas')[0].getContext('2d');
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, 500, 500);

var sketchpad = new NewSketchpad({
   element: '#canvas',
   width: 500,
   height: 500
});

Is there any working alternative available for this? Please help!

@rajdeepbhatia rajdeepbhatia changed the title Prefill whole canvas with white color Prefill whole canvas with color Apr 18, 2020
@gabcoh
Copy link

gabcoh commented Jun 11, 2020

Not sure if this will work for your specific use case, but you can just set the background style of the canvas to a specific color.

@UjjualUSspericorn
Copy link

I have done it by adding bg color to the sketchpad div .! I have also added a pellette for changing the canvas bg color

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

No branches or pull requests

3 participants