Random colour

Emmanuel Companys mcompanys at mac.com
Mon Jun 9 12:44:00 EDT 2003


Le lundi, 9 juin 2003, à 18:16 Europe/Paris, David Squance a écrit :

> Is there a simple way to randomize color of text and background of a 
> field
> without getting a combination which is unreadable?

A simple way I can think of is making a list of readable combination 
and then have the random function chose one:

get random (<number of lines of fld fCombinations>)
set textcolor of fld <field> to item 1 of line it of fld combinations.
set backgroundcolor of fld <field> to item 2 of line it of fld 
combinations

If you don't want to name the color by names, and use the 3 digits sets 
  then you need to change the item separator, of course.

To make your combination list, maybe you could begin with a simple 
color list (not more than a dozen of color), and have a script 
randomizing text and bg separately among the words in this list, 
displaying an  ANSWER "refuse" or "keep" and adding to the combination 
list if not refused. This way you could either eliminate the 
combination if it is unreadable (or really to uggly!)  or keep it in 
the definitive combination list.

But, is this psychedelic fantasy worth so much time and work? ;-)

I had a similar problem with fonts, styles and sizes: they had to be 
readable and fit in the display box.

Manuel




More information about the use-livecode mailing list