FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   *beware newbie* why the color() is not working?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: *beware newbie* why the color() is not working?  (Read 331 times)
lunetta

7200475272004752 WWW Email
*beware newbie* why the color() is not working?
« on: Mar 21st, 2004, 10:38pm »

Hi
 
I have a really dumb question;
Why this does not work?
 
color test = color(204, 50, 50);
 
void setup() {
size (200,200);
}
void loop() {
fill (test);
rect (0,0,100,100);
}
 
sorry for bothering with this extremely simple thing...
if the color is a primitive datatype, why can't a declare a global assigning a RGB value? the hex notation works...
Thanks!
 
fry


WWW
Re: *beware newbie* why the color() is not working
« Reply #1 on: Mar 21st, 2004, 10:58pm »

because color() is a function, and it's dependent on the current colorMode(), and the colorMode() is not set until you're inside of setup().  
 
but as you point out, this is a real nuisance, so i think i'll modify it to work as you have it in your program, just with colorMode(RGB, 255) since that's what most people are using.
 
sorry for the confusion..
 
lunetta

7200475272004752 WWW Email
Re: *beware newbie* why the color() is not working
« Reply #2 on: Mar 22nd, 2004, 6:17am »

Thanks!!
 
Pages: 1 

« Previous topic | Next topic »