100% pen. Press space to do it again, once you've changed the square size. Spam the space bar for all I care, it actually looks pretty cool (unless you do it while sliding the size, in which case it just gets messy). I tried commenting on the code to explain everything, feel free to use this code in whatever.
I found this project in my stuff, reminiscing on my time on scratch. Happy to find I'm not too rusty, I've fixed the few problems the original Checkboard/Chessboard generator had, it now has less scripts, runs more smoothly, looks better. I imagine that it would be pretty easy to make it instantaneous--but I'm not sure I want to, it's pretty satisfying to see it rendering. The fastest most failproof code is no code.