1. std/graphcst.e colors in OSX
- Posted by dukester Nov 09, 2009
- 4076 views
- COLOR values -- for characters and pixels public constant --** in graphics modes this is "transparent" BLACK = 0, GREEN = 2, MAGENTA = 5, WHITE = 7, GRAY = 8, BRIGHT_GREEN = 10, BRIGHT_MAGENTA = 13, BRIGHT_WHITE = 15 public integer BLUE, CYAN, RED, BROWN, BRIGHT_BLUE, BRIGHT_CYAN, BRIGHT_RED, YELLOW ifdef UNIX then BLUE = 4 CYAN = 6 RED = 1 BROWN = 3 BRIGHT_BLUE = 12 BRIGHT_CYAN = 14 BRIGHT_RED = 9 YELLOW = 11 elsedef BLUE = 1 CYAN = 3 RED = 4 BROWN = 6 BRIGHT_BLUE = 9 BRIGHT_CYAN = 11 BRIGHT_RED = 12 YELLOW = 14 end ifdef
Some of these constants are broken on OSX (xterm or native Terminal).
CYAN and YELLOW RED and BLUE B.RED and B.BLUE
need to be switched. They don't work as advertised. ;) The maintainer of this library should add another "ifdef" to cover OSX. I can help. Has anybody resolved this issue yet? Where's the best place for me to amend these constants? In /std/graphcst.e or in my own application code? TIA... duke
2. Re: std/graphcst.e colors in OSX
- Posted by jimcbrown (admin) Nov 09, 2009
- 4082 views
- COLOR values -- for characters and pixels public constant --** in graphics modes this is "transparent" BLACK = 0, GREEN = 2, MAGENTA = 5, WHITE = 7, GRAY = 8, BRIGHT_GREEN = 10, BRIGHT_MAGENTA = 13, BRIGHT_WHITE = 15 public integer BLUE, CYAN, RED, BROWN, BRIGHT_BLUE, BRIGHT_CYAN, BRIGHT_RED, YELLOW ifdef UNIX then BLUE = 4 CYAN = 6 RED = 1 BROWN = 3 BRIGHT_BLUE = 12 BRIGHT_CYAN = 14 BRIGHT_RED = 9 YELLOW = 11 elsedef BLUE = 1 CYAN = 3 RED = 4 BROWN = 6 BRIGHT_BLUE = 9 BRIGHT_CYAN = 11 BRIGHT_RED = 12 YELLOW = 14 end ifdef
Some of these constants are broken on OSX (xterm or native Terminal).
CYAN and YELLOW RED and BLUE B.RED and B.BLUE
need to be switched. They don't work as advertised. ;) The maintainer of this library should add another "ifdef" to cover OSX. I can help. Has anybody resolved this issue yet? Where's the best place for me to amend these constants? In /std/graphcst.e or in my own application code? TIA... duke
The formatting of the original post is horrible. No use of the eucode tag...
Anyways, I've added the ifdef and switched the values as you suggested in r2999.
3. Re: std/graphcst.e colors in OSX
- Posted by dukester Nov 09, 2009
- 4135 views
- COLOR values -- for characters and pixels public constant --** in graphics modes this is "transparent" BLACK = 0, GREEN = 2, MAGENTA = 5, WHITE = 7, GRAY = 8, BRIGHT_GREEN = 10, BRIGHT_MAGENTA = 13, BRIGHT_WHITE = 15 public integer BLUE, CYAN, RED, BROWN, BRIGHT_BLUE, BRIGHT_CYAN, BRIGHT_RED, YELLOW ifdef UNIX then BLUE = 4 CYAN = 6 RED = 1 BROWN = 3 BRIGHT_BLUE = 12 BRIGHT_CYAN = 14 BRIGHT_RED = 9 YELLOW = 11 elsedef BLUE = 1 CYAN = 3 RED = 4 BROWN = 6 BRIGHT_BLUE = 9 BRIGHT_CYAN = 11 BRIGHT_RED = 12 YELLOW = 14 end ifdef
Some of these constants are broken on OSX (xterm or native Terminal).
CYAN and YELLOW RED and BLUE B.RED and B.BLUE
need to be switched. They don't work as advertised. ;) The maintainer of this library should add another "ifdef" to cover OSX. I can help. Has anybody resolved this issue yet? Where's the best place for me to amend these constants? In /std/graphcst.e or in my own application code? TIA... duke
The formatting of the original post is horrible. No use of the eucode tag...
Anyways, I've added the ifdef and switched the values as you suggested in r2999.
Yeah! I saw what you meant about the formatting...
Thanks for the fix. I'll let you know if it works. Can I scoop the new graphcst.e file somewhere? duke
4. Re: std/graphcst.e colors in OSX
- Posted by jimcbrown (admin) Nov 09, 2009
- 4145 views
Thanks for the fix. I'll let you know if it works. Can I scoop the new graphcst.e file somewhere? duke
It is available on the web here: http://rapideuphoria.svn.sourceforge.net/viewvc/rapideuphoria/trunk/include/std/graphcst.e?revision=2999&pathrev=2999
5. Re: std/graphcst.e colors in OSX
- Posted by dukester Nov 09, 2009
- 4173 views
Thanks for the fix. I'll let you know if it works. Can I scoop the new graphcst.e file somewhere? duke
It is available on the web here: http://rapideuphoria.svn.sourceforge.net/viewvc/rapideuphoria/trunk/include/std/graphcst.e?revision=2999&pathrev=2999
Got it! Thanks! Now I also know that I can use "svn" ;) duke
6. Re: std/graphcst.e colors in OSX
- Posted by dukester Nov 09, 2009
- 4078 views
Shoot! No joy It's curious though, because the LSCOLORS env. var. for use with `ls', works perfectly - it displays all the ANSI colors in both xterm and the Apple terminal.
Here's the code that I'm using:
-- demo program 52 -- from Beginners Guide to Euphoria include std/graphics.e integer foreground_color sequence list_of_colors, already_used clear_screen() list_of_colors = {"BLUE","GREEN","CYAN","RED","MAGENTA","BROWN", "WHITE","GRAY","BRIGHT_BLUE","BRIGHT_GREEN", "BRIGHT_CYAN","BRIGHT_RED","BRIGHT_MAGENTA", "YELLOW","BRIGHT_WHITE"} already_used = {} for ix = 1 to 10 do foreground_color = rand(15) while find(foreground_color,already_used) do foreground_color = rand(15) end while already_used = already_used & foreground_color text_color(foreground_color) printf(1, "Text in %s\n",{list_of_colors[foreground_color]}) end for
Can anybody see a problem with it that would send the colors into a tail-spin? duke
7. Re: std/graphcst.e colors in OSX
- Posted by DerekParnell (admin) Nov 09, 2009
- 4052 views
Can anybody see a problem with it that would send the colors into a tail-spin?
Can you show us the output of that program? Also, what do you get when you run ...
eui -version
8. Re: std/graphcst.e colors in OSX
- Posted by DerekParnell (admin) Nov 09, 2009
- 4047 views
Can you show us the output of that program? Also, what do you get when you run ...
What I really meant was, for each of the color names, what do you think your operating system says is the correct number associated with them?
9. Re: std/graphcst.e colors in OSX
- Posted by DerekParnell (admin) Nov 09, 2009
- 4119 views
Here is another program you can run.
include std/graphics.e integer foreground_color sequence list_of_colors 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"} for i = 0 to length(list_of_colors) - 1 do foreground_color = i text_color(foreground_color) if foreground_color = 7 then bk_color(0) else bk_color(7) end if printf(1, "%d is %s\n",{foreground_color, list_of_colors[foreground_color + 1]}) end for
From this, you can see what color the operating system actually uses for each number. The program above will show correct values for Windows only.
After running this program, you should be able to see which numbers are needed for the correct colors on your operating system. Can you report back what you think we need to change, and be specific, for example...
BLUE should be 4 CYAN should be 12etc ...
10. Re: std/graphcst.e colors in OSX
- Posted by dukester Nov 09, 2009
- 4073 views
Hey Derek...
Here we go:
03:40 pm >> eui -version Euphoria Interpreter 4.0.0 development (r2681M) for OS X Using System Memory
The output of your test script is:
03:44 pm >> eui test-colors.ex 0 is BLACK 1 is BLUE 2 is GREEN 3 is CYAN 4 is RED 5 is MAGENTA 6 is BROWN 7 is WHITE 8 is GRAY 9 is BRIGHT_BLUE 10 is BRIGHT_GREEN 11 is BRIGHT_CYAN 12 is BRIGHT_RED 13 is BRIGHT_MAGENTA 14 is YELLOW 15 is BRIGHT_WHITE 03:40 pm >>
11. Re: std/graphcst.e colors in OSX
- Posted by dukester Nov 09, 2009
- 4039 views
I went ahead and edited the new OSX constants in $EUINC/std/graphcst.e on my own. I can't seem to get it working. These are good:
BLACK = 0, GREEN = 2, MAGENTA = 5, WHITE = 7, GRAY = 8, BRIGHT_GREEN = 10, BRIGHT_MAGENTA = 13, BRIGHT_WHITE = 15
These bomb out:
ifdef OSX then BLUE = 4 CYAN = 3 RED = 1 BROWN = 6 BRIGHT_BLUE = 12 BRIGHT_CYAN = 14 BRIGHT_RED = 9 YELLOW = 11
The problem is with blue/red, bright_blue/bright_red, cyan/brown, bright_cyan/yellow.
I've switched them back and forth in graphcst.e to no avail. It almost seems like there's other code getting in the way. Could that be possible? duke
12. Re: std/graphcst.e colors in OSX
- Posted by jimcbrown (admin) Nov 09, 2009
- 4064 views
I went ahead and edited the new OSX constants in $EUINC/std/graphcst.e on my own. I can't seem to get it working.
These bomb out:
ifdef OSX then BLUE = 4 CYAN = 3 RED = 1 BROWN = 6 BRIGHT_BLUE = 12 BRIGHT_CYAN = 14 BRIGHT_RED = 9 YELLOW = 11
The problem is with blue/red, bright_blue/bright_red, cyan/brown, bright_cyan/yellow.
I've switched them back and forth in graphcst.e to no avail. It almost seems like there's other code getting in the way. Could that be possible? duke
I just added a fix in r3003 to std/graphcst.e
Try grabbing that copy and see if it helps at all.
13. Re: std/graphcst.e colors in OSX
- Posted by dukester Nov 09, 2009
- 4035 views
I went ahead and edited the new OSX constants in $EUINC/std/graphcst.e on my own. I can't seem to get it working.
These bomb out:
ifdef OSX then BLUE = 4 CYAN = 3 RED = 1 BROWN = 6 BRIGHT_BLUE = 12 BRIGHT_CYAN = 14 BRIGHT_RED = 9 YELLOW = 11
The problem is with blue/red, bright_blue/bright_red, cyan/brown, bright_cyan/yellow.
I've switched them back and forth in graphcst.e to no avail. It almost seems like there's other code getting in the way. Could that be possible? duke
I just added a fix in r3003 to std/graphcst.e
Try grabbing that copy and see if it helps at all.
Sorry! No joy...
However, I did run a bash script that displays all the fg and bg colors. No problems! The script sends ANSI codes directly to screen.
normal color bright 30 black 40 31 red 41 32 green 42 33 yellow 43 34 blue 44 35 magenta 45 36 cyan 46 37 white 47
Must be something in the way Euphoria addresses the terminal itself? duke
14. Re: std/graphcst.e colors in OSX
- Posted by DerekParnell (admin) Nov 09, 2009
- 4035 views
It would sure speed things up if you just told what you were getting rather than what you're not getting.
For example, what color do you get for text_color(0), and for each of the other numbers from 1 to 15 inclusive?
15. Re: std/graphcst.e colors in OSX
- Posted by dukester Nov 09, 2009
- 4015 views
It would sure speed things up if you just told what you were getting rather than what you're not getting.
For example, what color do you get for text_color(0), and for each of the other numbers from 1 to 15 inclusive?
Here we go:
0 gives black 1 " red 2 " green 3 " yellow 4 " blue 5 " magenta 6 " cyan 7 " white 8 " gray 9 " bright-red 10 " bright-green 11 " bright-yellow 12 " bright-blue 13 " bright-magenta 14 " bright-cyan 15 " bright-white
16. Re: std/graphcst.e colors in OSX
- Posted by DerekParnell (admin) Nov 10, 2009
- 4061 views
Here we go: ...
Ok, I've uploaded another change to graphcst.e. This swaps the color numbers for cyan and brown. (Note, you used 'yellow' and 'bright-yellow' but the names for these in Euphoria are 'brown' and 'yellow' respectively.
17. Re: std/graphcst.e colors in OSX
- Posted by dukester Nov 10, 2009
- 4032 views
Here we go: ...
Ok, I've uploaded another change to graphcst.e. This swaps the color numbers for cyan and brown. (Note, you used 'yellow' and 'bright-yellow' but the names for these in Euphoria are 'brown' and 'yellow' respectively.
Thanks Derek! Still no joy....
Same problem colours...
18. Re: std/graphcst.e colors in OSX
- Posted by DerekParnell (admin) Nov 10, 2009
- 4073 views
Still no joy....
Same problem colours...
What does that mean, exactly?
Are you saying that when your program executes text_color(3) you are seeing some color other than BROWN? If so, what color are you seeing? And when your program executes text_color(6) you are seeing some color other than CYAN? If so, what color are you seeing?
What EXACTLY is displayed when you execute ...
eui -version
Can you also run this program and report back what you see it display ...
----- ifdef OSX then puts(1, "OSX") elsifdef UNIX then puts(1, "UNIX") elsedef puts(1, "WINDOWS") end ifdef ----
19. Re: std/graphcst.e colors in OSX
- Posted by DerekParnell (admin) Nov 10, 2009
- 4107 views
Just a couple of another things...
- What is the EUDIR environment symbol set to?
- Run this program ...
--- sequence s s = include_paths(0) for i = 1 to length(s) do printf(1, "%s\n", {s[i]}) end for ----
and tell us which of these directories contain std/graphcst.e ?
- can you show me what the contents of std/graphcst.e is?
20. Re: std/graphcst.e colors in OSX
- Posted by dukester Nov 10, 2009
- 4095 views
Just a couple of another things...
- What is the EUDIR environment symbol set to?
- Run this program ...
--- sequence s s = include_paths(0) for i = 1 to length(s) do printf(1, "%s\n", {s[i]}) end for ----
and tell us which of these directories contain std/graphcst.e ?
- can you show me what the contents of std/graphcst.e is?
Here we go:
dnormandin ~/programming/euphoria/code 06:25 am >> echo $EUDIR /Users/dnormandin/programming/euphoria dnormandin ~/programming/euphoria/code 06:26 am >> echo $EUINC /Users/dnormandin/programming/euphoria/include/:/Users/dnormandin/programming/euphoria/include/std:/Users/dnormandin/programming/euphoria/include/std/unix:/Users/dnormandin/programming/euphoria/include/std/net:/Users/dnormandin/programming/euphoria/include/euphoria dnormandin ~/programming/euphoria/code 06:36 am >> cat test-paths.ex sequence s s = include_paths(0) for i = 1 to length(s) do printf(1, "%s\n", {s[i]}) end for dnormandin ~/programming/euphoria/code 06:37 am >> eui test-paths.ex /Users/dnormandin/programming/euphoria/code /Users/dnormandin/programming/euphoria/include /Users/dnormandin/programming/euphoria/include/std /Users/dnormandin/programming/euphoria/include/std/unix /Users/dnormandin/programming/euphoria/include/std/net /Users/dnormandin/programming/euphoria/include/euphoria dnormandin ~/programming/euphoria/code 06:41 am >> cat ../include/std/graphcst.e -- (c) Copyright - See License.txt -- --**** -- === Error Code Constants -- namespace graphcst public enum BMP_SUCCESS, BMP_OPEN_FAILED, BMP_UNEXPECTED_EOF, BMP_UNSUPPORTED_FORMAT, BMP_INVALID_MODE --**** -- === video_config sequence accessors public enum VC_COLOR, VC_MODE, VC_LINES, VC_COLUMNS, VC_XPIXELS, VC_YPIXELS, VC_NCOLORS, VC_PAGES, VC_SCRNLINES, VC_SCRNCOLS --**** -- ==== Colors -- -- COLOR values -- for characters and pixels --** in graphics modes BLACK is "transparent" ifdef OSX then public constant BLACK = 0, RED = 1, GREEN = 2, BROWN = 3, BLUE = 4, MAGENTA = 5, CYAN = 6, WHITE = 7, GRAY = 8, BRIGHT_RED = 9, BRIGHT_GREEN = 10, YELLOW = 11, BRIGHT_BLUE = 12, BRIGHT_MAGENTA = 13, BRIGHT_CYAN = 14, BRIGHT_WHITE = 15, $ elsifdef UNIX then public constant BLACK = 0, RED = 1, GREEN = 2, BROWN = 3, BLUE = 4, MAGENTA = 5, CYAN = 6, WHITE = 7, GRAY = 8, BRIGHT_RED = 9, BRIGHT_GREEN = 10, YELLOW = 11, BRIGHT_BLUE = 12, BRIGHT_MAGENTA = 13, BRIGHT_CYAN = 14, BRIGHT_WHITE = 15, $ elsedef public constant BLACK = 0, BLUE = 1, GREEN = 2, CYAN = 3, RED = 4, MAGENTA = 5, BROWN = 6, WHITE = 7, GRAY = 8, BRIGHT_BLUE = 9, BRIGHT_GREEN = 10, BRIGHT_CYAN = 11, BRIGHT_RED = 12, BRIGHT_MAGENTA = 13, YELLOW = 14, BRIGHT_WHITE = 15, $ end ifdef --** -- Add to color to get blinking text public constant BLINKING = 16 public constant BYTES_PER_CHAR = 2 public type color(integer x) return x >= 0 and x <= 255 end type --**** -- === Routines --** -- Mixture Type -- -- Comments: -- -- A mixture is a ##{red, green, blue}## triple of intensities, which enables you to define -- custom colors. Intensities must be from 0 (weakest) to 63 (strongest). Thus, the brightest -- white is {63, 63, 63}. public type mixture(sequence s) if length(s) != 3 then return 0 end if for i=1 to 3 do if not integer(s[i]) then return 0 end if if and_bits(s[i],#FFFFFFC0) then return 0 end if end for return 1 end type constant M_VIDEO_CONFIG = 13 --** -- Return a description of the current video configuration: -- -- Returns: -- A **sequence**, of 10 non-negative integers, laid out as follows: -- # color monitor? ~-- 1 0 if monochrome, 1 otherwise -- # current video mode -- # number of text rows in console buffer -- # number of text columns in console buffer -- # screen width in pixels -- # screen height in pixels -- # number of colors -- # number of display pages -- # number of text rows for current screen size -- # number of text columns for current screen size -- -- Comments: -- -- A public enum is available for convenient access to the returned configuration data: -- * ##VC_COLOR## -- * ##VC_MODE## -- * ##VC_LINES## -- * ##VC_COLUMNS## -- * ##VC_XPIXELS## -- * ##VC_YPIXELS## -- * ##VC_NCOLORS## -- * ##VC_PAGES## -- * ##VC_LINES## -- * ##VC_COLUMNS## -- * ##VC_SCRNLINES## -- * ##VC_SCRNCOLS## -- -- This routine makes it easy for you to parameterize a program so it will work in many -- different graphics modes. -- -- Example: -- <eucode> -- vc = video_config() -- -- vc could be {1, 3, 300, 132, 0, 0, 32, 8, 37, 90} --
public function video_config() return machine_func(M_VIDEO_CONFIG, 0) end function </eucode>
21. Any updates on this forum bug?
- Posted by jimcbrown (admin) Nov 27, 2009
- 3918 views
It still shows up as a 500 internal error for me. http://oe.cowgar.com/forum/110286.wc#110286
Wasn't sure if we had a ticket for it either.
22. Re: Any updates on this forum bug?
- Posted by jimcbrown (admin) Dec 01, 2009
- 3750 views
Still no updates?
23. Re: Any updates on this forum bug?
- Posted by jimcbrown (admin) Dec 04, 2009
- 3488 views
I'd have expected that by now someone would have at least deleted the post (after saving a copy of the raw post first for later debugging) so the forum itself would stop issuing 500 errors...
24. Re: Any updates on this forum bug?
- Posted by jimcbrown (admin) Dec 11, 2009
- 3267 views
Anything? Anything at all?
25. Re: Any updates on this forum bug?
- Posted by jimcbrown (admin) Feb 07, 2010
- 2606 views
Almost beta3... any luck yet?
26. Re: Any updates on this forum bug?
- Posted by jimcbrown (admin) Mar 20, 2010
- 2110 views
Anything? Anything at all?
Ok, I've applied Matt's fix on Demonology and it fixes this bug. Any ETA on getting the fix applied here?
27. Re: Any updates on this forum bug?
- Posted by jimcbrown (admin) Mar 31, 2010
- 1631 views
Anything? Anything at all?
Ok, I've applied Matt's fix on Demonology and it fixes this bug. Any ETA on getting the fix applied here?
Glad to see that the forum has finally been updated.