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)
   background() return color?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: background() return color?  (Read 335 times)
smokinggun


background() return color?
« on: Oct 26th, 2003, 10:24pm »

I just upgraded from v58 to v66 and noted that background() no longer returns a value.
 
i suppose it makes less sense for background() to return a value, since it is no longer persistent.  
 
on the other hand it would be useful for calculations if background() would return its last value(at least for me.)
 
thanks - jw
 
fry


WWW
Re: background() return color?
« Reply #1 on: Oct 26th, 2003, 11:30pm »

yeah, we removed those, since they were weird api, and we couldn't quite imagine why people wouldn't know what background/fill/stroke color they had used.. i'd be curious as to how you were using it.
 
for now, you can use
color b = g.background;
which will give you the background color, though if it's an image, that'll just return the last color used.
 
these should also work:
color s = g.stroke;
color f = g.fill;
 
smokinggun


Re: background() return color?
« Reply #2 on: Oct 27th, 2003, 6:17am »

on Oct 26th, 2003, 11:30pm, fry wrote:
yeah, we removed those, since they were weird api, and we couldn't quite imagine why people wouldn't know what background/fill/stroke color they had used.. i'd be curious as to how you were using it.

 
thanks for the above, that will work just fine.
 
in an app i created the background color changed dynamically. so a routine was used to determine foreground colors of proper hue and contrast.
 
i preferred referencing the return value of background() rather than storing it in a separate variable.
 
Pages: 1 

« Previous topic | Next topic »