We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › HTML notation for colors vs. AutoFormat
Page Index Toggle Pages: 1
HTML notation for colors vs. AutoFormat (Read 478 times)
HTML notation for colors vs. AutoFormat
Feb 16th, 2010, 3:57pm
 
Enter the following program in processing without indenting.

void setup() {
size(300,300);
background(#ffff99);
}


It works great. Now try Tools/Auto Format. You will get a message:
Auto Format Canceled: Too many left parentheses.

Change the background line to read:

background(255, 255, 153);


Auto Format will work just fine. I know better than to use the # format for colors, but students who use Tools/Color Selector will invariably copy and paste the HTML notation.  Extra note: background(0xffff99); does not cause problems with AutoFormat

Re: HTML notation for colors vs. AutoFormat
Reply #1 - Feb 16th, 2010, 4:57pm
 
this is a well known problem.
you can either use variables for your color and still define them using hex values at the top of your sketch for example. when autoformating you can cut & paste the part with the hex values or just use the color tool to get the rgb values for your colors.
Page Index Toggle Pages: 1