Re: Linux eubins and console colours

new topic     » goto parent     » topic index » view thread      » older message » newer message

Something that I didn't notice before.

Running this code

#!/home/crylex/euphoria/bin/eui 
--test terminal colours - seems to be working on some terminals, but not others 
 
include std/graphics.e 
include std/graphcst.e 
include std/text.e 
include std/console.e 
 
integer ESC = 27 
 
integer key 
 
sequence colour_names = {"BLACK", 
                        "GREEN", 
                        "MAGENTA", 
                        "WHITE", 
                        "GRAY", 
                        "BRIGHT_GREEN", 
                        "BRIGHT_MAGENTA", 
                        "BRIGHT_WHITE", 
                        "BLUE", 
                        "CYAN", 
                        "RED", 
                        "BROWN", 
                        "BRIGHT_BLUE", 
                        "BRIGHT_CYAN", 
                        "BRIGHT_RED", 
                        "YELLOW"} 
sequence colour_values =  
                        {BLACK, 
                         GREEN, 
                         MAGENTA, 
                         WHITE, 
                         GRAY, 
                         BRIGHT_GREEN, 
                         BRIGHT_MAGENTA, 
                         BRIGHT_WHITE, 
                         BLUE, 
                         CYAN, 
                         RED, 
                         BROWN, 
                         BRIGHT_BLUE, 
                         BRIGHT_CYAN, 
                         BRIGHT_RED, 
                         YELLOW 
                        } 
 
integer fgrnd = 1, bgrnd = 1 
sequence fgn = "", bgn = "" 
integer blink_on = 0 
 
 
while 1 do 
        text_color(WHITE) 
        bk_color(BLACK) 
 
        clear_screen() 
        position(1,1) 
        puts(1,"This tests the screen colour capabilities of the terminal\n") 
        puts(1, "F - advance foreground colour\n") 
        puts(1, "B - advance background colour\n") 
 
 
        --get fg and bg names 
        fgn = "" bgn = "" 
        for i = 1 to 16 do 
                if colour_values[i] = fgrnd then 
                        fgn = colour_names[i] 
                end if 
        end for 
 
        for i = 1 to 16 do 
                if colour_values[i] = bgrnd then 
                        bgn = colour_names[i] 
                end if 
        end for 
 
        position(5,1) 
	text_color(WHITE) 
	bk_color(BLACK) 
 
        printf(1, "%-10s %-20s %-10s\n", {"", "Name", "Value"}) 
        printf(1, "%-10s %-20s %-10d\n", {"Fore", fgn, fgrnd}) 
        printf(1, "%-10s %-20s %-10d\n", {"Back", bgn, bgrnd}) 
        printf(1, "%-10s %d\n\n\n\n", {"Blink", blink_on}) 
 
        text_color(fgrnd + (blink_on * 16) ) 
        bk_color(bgrnd) 
 
        puts(1, "----------------------------------------------\n") 
        puts(1, "This is an example of what it would look like!\n") 
        puts(1, "----------------------------------------------\n") 
 
        key = wait_key() 
        if key = ESC then exit end if 
         
        if upper(key) = 'B' then 
              bgrnd += 1 
              if bgrnd = 17 then bgrnd = 1 end if 
        end if 
        if upper(key) = 'F' then 
              fgrnd += 1 
              if fgrnd = 17 then fgrnd = 1 end if 
        end if 
        if upper(key) = 'L' then 
              blink_on = (blink_on - 1) * -1 
        end if 
 
end while 

with r3061, on consoles that work, the background shows the bright colours, but with r2067 the background does not show the bright colours, just the normal colours (so BRIGHT_BLUE comes out as BLUE for instance)

Chris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu