Re: std/graphcst.e colors in OSX - cont.
- Posted by DerekParnell (admin) Nov 13, 2009
- 1217 views
dukester said...
Well it works! However, I don't understand why changing the order of the color names would matter? After all, we're randomly choosing an index number to access a color in the sequence. But it does... good eye! Thanks.
It seems that the problem was that the demo program you ran assumed you'd be using Windows and not OSX.
Anyhow, I've updated graphcst.e and graphics.e so that the same color numbers can be used on all platforms now to mean the same color.
And here is a better program to demonstrate this.
---- include graphics.e integer foreground_color sequence list_of_colors, already_used text_color(BLACK) bk_color(WHITE) clear_screen() list_of_colors = {"BLACK", "BLUE","GREEN","CYAN","RED","MAGENTA","BROWN", "WHITE","GRAY","BRIGHT_BLUE","BRIGHT_GREEN", "BRIGHT_CYAN","BRIGHT_RED","BRIGHT_MAGENTA", "YELLOW","BRIGHT_WHITE", -- Now for the 'blinking' names "B-BLACK", "B-BLUE","B-GREEN","B-CYAN","B-RED","B-MAGENTA", "B-BROWN", "B-WHITE","B-GRAY","B-BRIGHT_BLUE","B-BRIGHT_GREEN", "B-BRIGHT_CYAN","B-BRIGHT_RED","B-BRIGHT_MAGENTA", "B-YELLOW","B-BRIGHT_WHITE", $} already_used = {} while length(already_used) < 31 do while find(foreground_color,already_used) with entry do entry foreground_color = rand(32)-1 end while already_used = already_used & foreground_color text_color(foreground_color) if find(foreground_color, {WHITE, WHITE + 16}) then bk_color(BLACK) else bk_color(WHITE) end if printf(1, "Text in %s\n",{list_of_colors[foreground_color+1]}) end while text_color(BLACK) bk_color(WHITE) ----