processing / p5.js-editor

Deprecated desktop editor for p5.js
https://p5js.org
MIT License
338 stars 91 forks source link

Support styling and multiple arguments in console.* methods #244

Closed mattdesl closed 8 years ago

mattdesl commented 8 years ago

Hello! Nice tool. :smile:

I'm not familiar with Processing so forgive me if this was an intentional decision made for some legacy reason. But I've noticed console.log(2, 4, 2) only prints the first argument, which is non-standard in the rest of the JS world. I've also noticed that console.log('%cHello', 'background: red') does not style, since it is looking for a third argument.

This PR changes it so that users can pass multiple arguments to console.log and they will all appear in the debug console. It also improves the styling a bit so it works a little more reliably.

Examples:

console.log(width, height);
//=> 50 150

console.log('%chello', 'background: red');
//=> "hello" (in red)

console.log('%chello', 'background: red', 2);
//=> "hello" 2 (in red)
lmccart commented 8 years ago

very helpful, thanks!